ImageImage

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Cannot import modules from Zip64 files
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: lfamorim
Priority: normal Keywords:

Created on 2021-10-22 16:40 by lfamorim, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg404792 - (view) Author: Luis Franca (lfamorim) Date: 2021-10-22 16:40
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

2. 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

3. 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!
History
Date User Action Args
2022-04-11 14:59:51adminsetgithub: 89739
2021-10-22 16:40:33lfamorimcreate