import os
import zipfile
def zip():
form = FORM(TABLE("", INPUT(_type="submit",_value="SUBMIT")))
if form.accepts(request.vars):
uploaded_files = os.listdir([os.getcwd
(),'applications',request.application, 'uploads'])
zipf = zipfile.Zipfile(os.getcwd(),
'applications',request.application,
'uploads','uploads_backup.zip','w')
for f in uploaded_files:
try: zipf.write(f)
except: pass
#return encode('rot13')
f.close()
return dict(form=form)
return unicode
Traceback (most recent call last):
File "/Users/mdipierro/web2py/gluon/restricted.py", line 98, in
restricted
File "C:/Documents and Settings/__/Desktop/web2py_win/web2py/
applications/cynoteDup/controllers/zip.py", line 24, in <module>
File "/Users/mdipierro/web2py/gluon/globals.py", line 74, in
<lambda>
File "C:/Documents and Settings/__/Desktop/web2py_win/web2py/
applications/cynoteDup/controllers/zip.py", line 10, in zip
TypeError: coercing to Unicode: need string or buffer, list found
On Feb 10, 1:59 pm, mdipierro <[email protected]> wrote:
> please post code and traceback else it is hard to figure out what the
> issue is.
>
> Massimo
>
> On Feb 9, 11:52 pm, INeedHelp <[email protected]> wrote:
>
>
>
> > I want to zip a file in a folder.
> > but with this error
>
> > TypeError: coercing to Unicode: need string or buffer, list found- Hide
> > quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---