Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6091741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:21:46+00:00 2026-05-23T12:21:46+00:00

I need to zip a set of blobs available in data store. These can

  • 0

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()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:21:47+00:00Added an answer on May 23, 2026 at 12:21 pm

    Per the zipfile documentation:

    There is no official file name encoding for ZIP files.
    If you have unicode file names, you must convert them to byte strings in your desired encoding before passing them to write().

    Try to encode your filename in UTF-8 for example with:

    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.encode('utf-8'), my_data)
            z.close()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to sort through a data set which as you can see I've
I need to extract the zip code from a string. The string looks like
I need to programatically encrypt a directory of files, like in a .zip or
I'm trying to write an MsBuild script to zip some files up. I need
I have a data set that is generated by a Zip Code range search:
I need to take two sets of data and produce one set of pairs(tuples)
I need some help on a MySQL query I'm trying to set up. I
I need to unzip a set of files that are a zip archive. This
i have a php script where i need to create a zip archive with
Possible Duplicate: What is the ultimate postal code and zip regex? I need Regex

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.