shutil.make_archive() not working

Started by HamedHem, April 05, 2018, 06:47:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

HamedHem

Hi ,

I'm writing an script to collect all project assets and store them into a zip file but when I'm using shutil.make_archive() , Keyshot gives me the following error :


Traceback (most recent call last):
  File "console", line 1, in <module>
  File "C:\Program Files\KeyShot7\bin\py-dist\shutil.py", line 784, in make_archive
    filename = func(base_name, base_dir, **kwargs)
  File "C:\Program Files\KeyShot7\bin\py-dist\shutil.py", line 684, in _make_zipfile
    compression=zipfile.ZIP_DEFLATED) as zf:
  File "C:\Program Files\KeyShot7\bin\py-dist\zipfile.py", line 1079, in __init__
    if isinstance(file, os.PathLike):
AttributeError: 'module' object has no attribute 'PathLike'


Anyone knows why I'm getting such an error ?

Regards.

Will Gibbons

Curious as to why you would do this... 'Save KSP' in KeyShot does exactly this without requiring a script.

DriesV

Curious to know the motivation as well.
Or would you like to save ksp files through scripting?

Dries

HamedHem

Hi Guys ,

Thanks for your response ,

I'm not doing this script for myself , I've got a request for this and trying to see if possible , they want to have a packed file like zip instead of KSP file , when I've gone through the bip file in notepad , I found that all the assets paths are stored in the file so I'm collecting all the assets this way and after that I want to pack them all into a zip file but I've got the above error .

I've also run my script in 'pycharm' and it works just fine so not sure what is going wrong in keyshot console .

Thanks.

INNEO_MWo

It sounds stupid, but why don't rename the .ksp to .ksp.zip? Cause it is an archive and can be opens with e.g. 7zip.