[Python-Dev] Python 3.4 change in importlib/init.py breaking cxFreeze? (original) (raw)

Jurko Gospodnetić jurko.gospodnetic at pke.hr
Mon Mar 10 16🔞58 CET 2014


Hi Nick.

On 10.3.2014. 14:25, Nick Coghlan wrote:> What is supposed to happen when that code gets loaded from a ZIP archive?

file is expected to always be set (including when loaded from a zipfile - in that case it's the zipfile name concatenated with the path within the zip file). If it isn't set, there's a buggy loader involved somewhere that isn't setting it properly.

I don't recall seeing that ever explicitly stated. For that matter, Python 3.4.0rc3 documentation explicitly states:

file is optional. If set, this attribute’s value must be a string. The import system may opt to leave file unset if it has no semantic meaning (e.g. a module loaded from a database).

and:

Ultimately, the loader is what makes use of file and/or cached.

Or is this some rule specific to the importlib/init.py stdlib module?

As I recall, I first learned that not all loaded modules need to have their file attribute set by researching a failure in some package when installed as a zipped-egg using setuptools. Admittedly though, that was some old setuptools version.

Best regards, Jurko Gospodnetić



More information about the Python-Dev mailing list