form_upload = SQLFORM.factory(Field('your_excel_file', 'upload',uploadfolder
='helloworld/uploads'))
if form_upload.process().accepted:
session.your_excel_file = form.vars.your_excel_file
def import_from_excel():
workbook = xlrd.open_workbook(session.your_excel_file)
When import_from_excel() is called gives rise to the below error.
How to access excel file stored in session?
File "F:/trr/web2py/web2py/applications/helloworld/controllers/cms_meas.py"
<http://127.0.0.1:8000/admin/default/edit/helloworld/controllers/cms_meas.py>,
line 255, in import_from_excel
workbook = xlrd.open_workbook(session.your_excel_file)
File "D:\Python\lib\site-packages\xlrd\__init__.py", line 366, in
open_workbook
formatting_info=formatting_info,
File "D:\Python\lib\site-packages\xlrd\__init__.py", line 725, in __init__
f = open(filename, open_mode)
TypeError: coercing to Unicode: need string or buffer, NoneType found
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.