kivy / kivy-ios

Toolchain for compiling Python / Kivy / other libraries for iOS
https://kivy.org/docs/guide/packaging-ios.html
MIT License
759 stars 238 forks source link

zipfile.BadZipFile: File is not a zip file error #687

Closed marios-pz closed 2 years ago

marios-pz commented 2 years ago

I was following this guide https://kivy.org/doc/stable/guide/packaging-ios.html, by the time I run toolchain build kivy I got this error. All previous steps were done correctly.

Python: 3.9 kivy-ios: latest Xcode : Version 13.2.1 (13C100) Hardware/OS: Monterey 12.3 (M1)

[DEBUG   ] Cached result: Build_all pyobjus. Ignoring
[INFO    ] Download kivy
Traceback (most recent call last):
  File "/opt/homebrew/bin/toolchain", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1555, in main
    ToolchainCL()
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1299, in __init__
    getattr(self, args.command)()
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1368, in build
    build_recipes(args.recipe, ctx)
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1142, in build_recipes
    recipe.execute()
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 701, in execute
    self.download()
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 74, in _cache_execution
    f(self, *args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 738, in download
    status = self.get_archive_rootdir(self.archive_fn)
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 534, in get_archive_rootdir
    with zipfile.ZipFile(filename) as zf:
  File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/zipfile.py", line 1257, in __init__
    self._RealGetContents()
  File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/zipfile.py", line 1324, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
misl6 commented 2 years ago

Hi @mariospapaz This usually happens when the downloaded file is corrupted or incomplete. Can you please delete the .zip related to kivy into your .cache folder and try again?

Also, I see you're on Monterey 12.3, so you should probably take a look at : #688

marios-pz commented 2 years ago

I was wrong, my os is actually 12.2.1

But I did update kivy-ios from pip and still got an error. Yet it worked after I removed kivy from .cache and run the command. Thanks!

(And also great news that they finally removing python2) You can close my post now, I believe its solved