Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[traceback] zipfile.BadZipFile: File is not a zip file #148

Open
daisseur opened this issue Apr 21, 2023 · 7 comments
Open

[traceback] zipfile.BadZipFile: File is not a zip file #148

daisseur opened this issue Apr 21, 2023 · 7 comments
Labels
good first issue Good for newcomers Hacktoberfest 🎃🐱‍💻 DO's annual PR encouragement invalid This doesn't seem right question Further information is requested

Comments

@daisseur
Copy link

daisseur commented Apr 21, 2023

I'm on a python project and i use github action to publish my pypi python package the python project is https://github.com/daisseur/Deltacode_project/ when the package is publishing i got this error:

Traceback (most recent call last):
  File "/usr/local/bin/twine", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/twine/__main__.py", line 33, in main
    error = cli.dispatch(sys.argv[1:])
  File "/usr/local/lib/python3.9/site-packages/twine/cli.py", line 123, in dispatch
    return main(args.args)
  File "/usr/local/lib/python3.9/site-packages/twine/commands/check.py", line 183, in main
    return check(parsed_args.dists, strict=parsed_args.strict)
  File "/usr/local/lib/python3.9/site-packages/twine/commands/check.py", line 129, in check
    warnings, is_ok = _check_file(filename, render_warning_stream)
  File "/usr/local/lib/python3.9/site-packages/twine/commands/check.py", line 73, in _check_file
    package = package_file.PackageFile.from_filename(filename, comment=None)
  File "/usr/local/lib/python3.9/site-packages/twine/package.py", line 96, in from_filename
    meta = DIST_TYPES[dtype](filename)
  File "/usr/local/lib/python3.9/site-packages/twine/wininst.py", line [17](https://github.com/daisseur/Deltacode_project/actions/runs/4769442414/jobs/8479836531#step:7:18), in __init__
    self.extractMetadata()
  File "/usr/local/lib/python3.9/site-packages/pkginfo/distribution.py", line 1[23](https://github.com/daisseur/Deltacode_project/actions/runs/4769442414/jobs/8479836531#step:7:24), in extractMetadata
    data = self.read()
  File "/usr/local/lib/python3.9/site-packages/twine/wininst.py", line 33, in read
    archive = zipfile.ZipFile(fqn)
  File "/usr/local/lib/python3.9/zipfile.py", line 1[26](https://github.com/daisseur/Deltacode_project/actions/runs/4769442414/jobs/8479836531#step:7:27)6, in __init__
    self._RealGetContents()
  File "/usr/local/lib/python3.9/zipfile.py", line 1[33](https://github.com/daisseur/Deltacode_project/actions/runs/4769442414/jobs/8479836531#step:7:34)3, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
Checking dist/DeltacodeProject.exe:
@webknjaz
Copy link
Member

Remove dist/DeltacodeProject.exe. It can't be published.

@daisseur
Copy link
Author

Remove dist/DeltacodeProject.exe. It can't be published.

Okay thank you but how can I remove it from the github action whithout remove the exe from the repo

@webknjaz webknjaz added invalid This doesn't seem right question Further information is requested labels May 2, 2023
@webknjaz
Copy link
Member

webknjaz commented May 2, 2023

@daisseur firstly, committing binaries to Git repositories is a bad idea. Second, if that's an artifact, it should probably be built within a GHA workflow. Finally, even if you put it into the directory on disk, you can still delete it in GHA via rm -f dist/*.exe or use a different directory for producing/supplying dists. You don't even need a repository checkout for the publishing job — build whatever you're publishing in one job (or many jobs, for that matter), store it as an artifact, get the artifact within the publishing job and make sure you don't add undesired files into that folder.

@webknjaz webknjaz changed the title [BUG] zipfile.BadZipFile: File is not a zip file [traceback] zipfile.BadZipFile: File is not a zip file May 2, 2023
@daisseur
Copy link
Author

daisseur commented May 2, 2023

@webknjaz okay thank you

@webknjaz
Copy link
Member

Action item:

  • Update the README to mention that only the dists recognized by Twine are expected and anything else is unsupported

@webknjaz webknjaz added good first issue Good for newcomers Hacktoberfest 🎃🐱‍💻 DO's annual PR encouragement labels Nov 29, 2023
@ShukantPal

This comment has been minimized.

@MarkCallow

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Hacktoberfest 🎃🐱‍💻 DO's annual PR encouragement invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants