christopher-ramirez / secretary

Take the power of Jinja2 templates to OpenOffice and LibreOffice.
Other
190 stars 48 forks source link

BadZipFile Error #27

Closed thomascothran closed 8 years ago

thomascothran commented 8 years ago

Attempting to pass an odt file to Renderer produces the following error:

2016-03-05 16:47:12,430 - DEBUG - Initing a Renderer instance
Template
 2016-03-05 16:47:12,431 - DEBUG - Initing a template rendering
 2016-03-05 16:47:12,431 - DEBUG - Unpacking template file
Traceback (most recent call last):
  File "./create_vs300.py", line 136, in <module>
    template = open('./styles/vs300.odt', 'r')
  File "./create_vs300.py", line 85, in fillOutDoc
    dict=answers_dict
  File "/home/mint/Python_Projects/virtualenvs/Document_Generator/lib/python3.4/site-packages/secretary.py", line 577, in render
    self.files = self._unpack_template(template)
  File "/home/mint/Python_Projects/virtualenvs/Document_Generator/lib/python3.4/site-packages/secretary.py", line 167, in _unpack_template
    archive = zipfile.ZipFile(template, 'r')
  File "/usr/lib/python3.4/zipfile.py", line 937, in __init__
    self._RealGetContents()
  File "/usr/lib/python3.4/zipfile.py", line 978, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

The .odt file I have does not appear to be corrupted. I can use it in LibreOffice just fine. Github won't let me upload an odt file for some reason, but if it's helpful, I can upload it elsewhere and post the link here.

christopher-ramirez commented 8 years ago

Hello! What version of LibreOffice are you using to create the template?

thomascothran commented 8 years ago

It's Version: 4.4.3.2. I'm running it on Linux Mint 17.2. I've tried to upload it here, but I get a "Something went really wrong, and we can't process that file." I'm not sure what the preferred backup filehost would be, but if it's helpful, I've uploaded the .odt file here.

christopher-ramirez commented 8 years ago

I couldn't reproduce the error with python 3.4 using the template provided. Have you digged into this issue?

thomascothran commented 8 years ago

I don't really know what I'm doing enough to pin down where the problem is. I'm pretty new to programming. The bad zip file error comes from the zipfile module, though, so maybe the problem is there. If you're unable to reproduce it, maybe it's best to close this, and I can open another ticket if I get the same issue with a different libreoffice file.

christopher-ramirez commented 8 years ago

I will close this issue for now, but if you can find any relevant information, please continue this thread and avoid opening a new one.

Regards,