BatchIDMLGenerator icon indicating copy to clipboard operation
BatchIDMLGenerator copied to clipboard

Error Message: idml is not a zip file

Open emuda opened this issue 1 year ago • 5 comments

Thanks for sharing these codes!

I tried running your example .py with your .idml and .csv and received this error:

Traceback (most recent call last): File "/Users/xxx/Downloads/BatchIDMLGenerator-master/batch_idml_editor.py", line 34, in shutil.unpack_archive(idml,template, 'zip') File "/Users/xxx/miniconda3/lib/python3.12/shutil.py", line 1381, in unpack_archive func(filename, extract_dir, **dict(format_info[2]), **filter_kwargs) File "/Users/xxx/miniconda3/lib/python3.12/shutil.py", line 1277, in _unpack_zipfile raise ReadError("%s is not a zip file" % filename) shutil.ReadError: /Users/xxx/Downloads/example/business_cards_template.idml is not a zip file

What could be the issue?

emuda avatar May 28 '24 20:05 emuda

Hi @emuda. I haven't looked at this code in a while, but based on you error, it seems like maybe it is trying to open the wrong file. In particular, the first line shows /Users/xxx/Downloads/BatchIDMLGenerator-master but the last line shows /Users/xxx/Downloads/example/. It should be looking in the /Users/xxx/Downloads/BatchIDMLGenerator-master/example folder for the idml file.

Can you confirm that your folder looks like in this screenshot (with the Python file 1 directory above the example folder? Screen Shot 2024-05-28 at 3 42 02 PM

Could you also share how you are running the script. It is possible that if you were running it from a different directory (for example python3 BatchIDMLGenerator-master/batch_idml_editor.py ) that you might have an error like this.

bsalinas avatar May 28 '24 20:05 bsalinas

Thanks for the prompt response Ben! You were right. I had the files in separate folders. I placed them in the same one and it worked.

It also worked on my idml and csv and the script provided me separate idml for each of my csv entry. However, all the content defaults at the content of the 1st entry but with separate filenames. Any thoughts on what could be the issue?

Thanks!

emuda avatar May 28 '24 21:05 emuda

I got it working! Instead of using << and >> I used ### based on your example.

Do you know if this script works with importing images as well?

emuda avatar Jun 04 '24 14:06 emuda

I am also having the issue importing images into the IDML file. Would love some best practices here? I can only get as far as getting the image file name into the idml but not the image itself.

alexatnv avatar Jun 04 '24 17:06 alexatnv

Hi @emuda. I'm glad you were able to get it working. I think the "###" is needed because of how the script is written.

Unfortunately, I don't think this tool is going to be able to manage including images. I believe it will only work with text itself.

bsalinas avatar Jun 04 '24 21:06 bsalinas