I need to zip a set of blobs available in data store. These can of different types like some html/images/swf/ etc. where all these are available in datastore as blob.
I tried to implement this solution: Zipping dynamic files in App Engine (Python)?
Tried with some static texts it worked great, I am also able to create a zip with a set of files with respective content but I could not trace out some issue when making zip from query.
z.writestr(fil.Template_name, my_data.encode('UTF-8'))
File "C:\Python25\lib\zipfile.py", line 626, in writestr
self.fp.write(zinfo.FileHeader())
File "C:\Python25\lib\zipfile.py", line 260, in FileHeader
return header + self.filename + extra
UnicodeDecodeError: 'ascii' codec can't decode byte 0xde in position 12: ordinal not in range(128)
This is the error for this part of code
class filesDB(db.model)
Template_file = db.BlobProperty()
Template_name= db.StringProperty()
output = StringIO.StringIO()
z = zipfile.ZipFile(output,'w')
files = filesDB.all().filter("fCreatedBy","sandeep")
for fil in files:
my_data = fil.Template_file
z.writestr(fil.Template_name, my_data)
z.close()