My mistake,
I was looking at the wrong line of code, there is no data that comes to
zipf.writestr
I apologize
Thank you anyway
Sorry for not being factual about my problem
On Tuesday, February 16, 2016 at 8:40:59 PM UTC+1, Niphlod wrote:
>
> how much is "lots" ? if it was a memory problem, the traceback would
> probably return something else... also... what's the line that raises the
> error ?
>
> On Tuesday, February 16, 2016 at 8:00:14 PM UTC+1, Yebach wrote:
>>
>> Hello
>>
>> I have a following problem
>>
>> When I try to serve a zip file to user i get the following error
>>
>> Uncompressed size\nTypeError: object of type \'NoneType\' has no len()
>>
>> There is data to be compressed, but there is lots of it so this I believe
>> is causing the problem
>>
>> my code is the following:
>>
>> def exportLssOut():
>> scriptId = request.args[0]
>> userId = auth.user_id
>> ExportConditionsCheck(userId)
>> query = db(db.scripts.id ==
>> scriptId).select(db.scripts.sc_engine_output, db.scripts.sc_lls,
>>
>> db.scripts.sc_menu_data, db.scripts.sc_errors).first()
>>
>> engineOutData = query['sc_engine_output']
>> llsData = query['sc_lls']
>> jsonDb = query['sc_menu_data']
>> jsonErrors = query['sc_errors']
>> #
>> import zipfile, cStringIO
>> exported_chunks_zip = cStringIO.StringIO()
>> zipf = zipfile.ZipFile(exported_chunks_zip, "w",
>> compression=zipfile.ZIP_STORED )
>>
>> zipf.writestr('%s_lls.txt' % str(scriptId), llsData)
>> zipf.writestr('%s_out.txt' % str(scriptId), engineOutData)
>> zipf.writestr('%s_json.txt' % str(scriptId), jsonDb)
>> zipf.writestr('%s_json_err.txt' % str(scriptId), jsonErrors)
>>
>> zipf.close()
>>
>> moment = datetime.datetime.now().strftime('%Y%m%dT%H%M%S')
>> response.headers['Content-Type']='multipart/x-zip'
>> response.headers['Content-Disposition']='attachment;
>> filename=ExportLLSOUT_%s.zip'% (moment)
>> #formatedDateTime = '%s%s%sT%s%s%s' % (dateTimeNow.year,
>> dateTimeNow.month, dateTimeNow.day
>> ,dateTimeNow.hour,dateTimeNow.minute,dateTimeNow.second )
>> return exported_chunks_zip.getvalue()
>>
>>
>>
>> any suggestions?
>>
>> thank you
>>
>>
>>
>>
--
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.