Skip to content

Cannot import modules from Zip64 files #89739

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

Closed
luisffranca mannequin opened this issue Oct 22, 2021 · 1 comment · Fixed by #94146
Closed

Cannot import modules from Zip64 files #89739

luisffranca mannequin opened this issue Oct 22, 2021 · 1 comment · Fixed by #94146
Assignees
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@luisffranca
Copy link
Mannequin

luisffranca mannequin commented Oct 22, 2021

BPO 45576
Nosy @luisffranca

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-10-22.16:40:33.579>
labels = ['type-bug', 'library', '3.9']
title = 'Cannot import modules from Zip64 files'
updated_at = <Date 2021-10-22.16:40:33.579>
user = 'https://github.com/luisffranca'

bugs.python.org fields:

activity = <Date 2021-10-22.16:40:33.579>
actor = 'lfamorim'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2021-10-22.16:40:33.579>
creator = 'lfamorim'
dependencies = []
files = []
hgrepos = []
issue_num = 45576
keywords = []
message_count = 1.0
messages = ['404792']
nosy_count = 1.0
nosy_names = ['lfamorim']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue45576'
versions = ['Python 3.9']

Linked PRs

@luisffranca
Copy link
Mannequin Author

luisffranca mannequin commented Oct 22, 2021

I've tried to import a module from a fat jar file and got a ModuleNotFoundError: No module named ... error.

I checked that the jar file had more than 65k files and was created using Zip64. When I unzip the file, Python is capable of importing the modules.

I was able to reproduce the error on a simple project, such as:

simplePackage/
__init__.py
a/
__init__.py
moduleA.py

where

  • I'm using Python 3.9.4
  • __init__.py files are empty
  • moduleA.py only has a printA() function

I ran the following tests:

  1. When importing from the folder, it works
python
>>> import sys
>>> sys.path.append('C:\\Users\\...\\simplePackage')
>>> from a.moduleA import printA
>>> printA()
I'm module a
  1. When zipping the folder, it works
python
>>> import sys
>>> sys.path.append('C:\\Users\\...\\simplePackage.zip')
>>> from a.moduleA import printA
>>> printA()
I'm module a
  1. When forcing to zip with Zip64 it doesn't work

On linux: zip -fzr simple64Package.zip .

python
>>> import sys
>>> sys.path.append('C:\\Users\\...\\simple64Package.zip')
>>> from a.moduleA import printA
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'a'

Is this an expected behavior? Am I missing something?

Thanks!

@luisffranca luisffranca mannequin added 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Oct 22, 2021
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@gpshead gpshead added 3.13 bugs and security fixes type-feature A feature request or enhancement and removed 3.9 only security fixes type-bug An unexpected behavior, bug, or error labels Sep 6, 2023
@gpshead gpshead self-assigned this Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant