I'm not familiar with excelpy, but I use xlrd and xlwt to read and write
Excel files with Python. Works with web2py just fine.
-Jim
On 6/13/2012 4:18 PM, Janath wrote:
Hi,
I try to use excelpy module in web2py, and it raises following error.
I do the same in python and it works properly.
my code in controller is:
def excelpy_test():
import excelpy
exl_temp=excelpy.workbook('perturb')
exl_temp.show()
Be kind to let me know if working with excelpy in web2py is not a good
idea. So I can try doing another way.
Workarounds to generate .csv files are welcome.
Appreciate help!
Janath
TICKET ID
127.0.0.1.2012-06-13.16-11-18.027f232a-2c5b-4944-a3ba-a56467d3302c
<type 'exceptions.AttributeError'> xlLandscape
VERSION
web2py™ (1, 99, 7, datetime.datetime(2012, 3, 4, 22, 12, 8), 'stable')
Python Python 2.5.1: C:\Python25\pythonw.exe
TRACEBACK
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
Traceback(most recent call last):
File"C:\Users\umgeegan\Desktop\web2py_src\web2py\gluon\restricted.py",line205,inrestricted
execccodeinenvironment
File"C:/Users/umgeegan/web2py_src/web2py/applications/PythonPSSE/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/PythonPSSE/controllers/default.py>,line220,in<module>
File"C:\Users\umgeegan\Desktop\web2py_src\web2py\gluon\globals.py",line173,in<lambda>
self._caller=lambdaf:f()
File"C:/Users/umgeegan/web2py_src/web2py/applications/PythonPSSE/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/PythonPSSE/controllers/default.py>,line139,inexcelpy_test
exl_temp=excelpy.workbook('perturb')
File".\excelpy.py",line1753,inworkbook
File".\excelpy.py",line186,in__init__
File".\excelpy.py",line1398,in_get_constants
File"C:\Python25\lib\site-packages\win32com\client\__init__.py",line168,in__getattr__
raiseAttributeError,a
AttributeError:xlLandscape
ERROR SNAPSHOT help
|<type 'exceptions.AttributeError'>(xlLandscape)|
inspect attributes
Frames
*
*File
C:\Users\umgeegan\Desktop\web2py_src\web2py\gluon\restricted.py in
restricted at line 205* code arguments variables
*
*File
C:\Users\umgeegan\web2py_src\web2py\applications\PythonPSSE\controllers\default.py
in <module> at line 220* code arguments variables
*
*File C:\Users\umgeegan\Desktop\web2py_src\web2py\gluon\globals.py
in <lambda> at line 173* code arguments variables
*
*File
C:\Users\umgeegan\web2py_src\web2py\applications\PythonPSSE\controllers\default.py
in excelpy_test at line 139* code arguments variables
*
*File C:\Users\umgeegan\web2py_src\web2py\excelpy.py in workbook
at line 1753* code arguments variables
*
*File C:\Users\umgeegan\web2py_src\web2py\excelpy.py in __init__
at line 186* code arguments variables
*
*File C:\Users\umgeegan\web2py_src\web2py\excelpy.py in
_get_constants at line 1398* code arguments variables
*
*File C:\Python25\lib\site-packages\win32com\client\__init__.py in
__getattr__ at line 168* code arguments variables
Function argument list
(self=<win32com.client.Constants instance at 0x0752BE40>,
a='xlLandscape')
Code listing
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
self.__dicts__= []# A list of dictionaries
def__getattr__(self,a):
fordin self.__dicts__:
ifd.has_key(a):
returnd[a]
raise AttributeError, a
# And create an instance.
constants = Constants()
Variables
a 'xlLandscape'
builtinAttributeError <type 'exceptions.AttributeError'>