Title: load_module() docs: zipped eggs are not loaded.
Type: Stage:
Components: Documentation Versions: Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: BreamoreBoy, Thomas Güttler, brett.cannon, docs@python, guettli, paul.moore
Priority: normal Keywords:

Created on 2015-03-10 11:14 by Thomas Güttler, last changed 2015-03-17 14:48 by BreamoreBoy. This issue is now closed.

Messages (8)
msg237746 - (view) Author: Thomas Güttler (Thomas Güttler) * Date: 2015-03-10 11:14
Please update the docs of imp.find_module()

zipped egg files in sys.path are not found.

Please provide a link how to find modules in sys.path like the interpreter does (with support of zipped egg files).
msg237871 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-03-11 14:59
Egg files are not a part of the Python stdlib and so I don't understand why you expected them to be supported by imp? Anyway, because egg files are not from Python itself but a third-party project they shouldn't be referenced from the official docs as it would just confuse people who don't know what eggs even are.
msg237882 - (view) Author: Thomas Guettler (guettli) Date: 2015-03-11 16:23
Dear Bret Cannon,

I don't ask for egg support in the imp module.
I don't want to change the implemenation of imp.find_module()

I just want to update the docs.

Most people run a python version which supports loading zipped eggs.

Please reopened this, since I think you misunderstood me. If not, and you don't care about the docs. Leave it closed :-)
msg237937 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-03-12 14:24
I understood what you asked. My point is that mentioning eggs in the imp doesn't make sense since the imp module nor import supports them natively. Eggs are a setuptools thing, not a Python standard library thing.
msg238267 - (view) Author: Thomas Guettler (guettli) Date: 2015-03-17 09:31
In this case I am wearing newbee user glasses.

And with this glasses on my nose, I don't care for implementation.

I am confused that imp module does not work like "import foo".
msg238271 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2015-03-17 10:05
Egg files are a format defined by setuptools. If you look in the setuptools documentation it notes that egg files are simply zipfiles with a particular structure and naming convention. So from a core Python perspective, you can use eggs just like any other zipfile. See the zipimport documentation for further details if you need them.

To further confuse the issue, setuptools includes some pretty complex mechanisms for adding eggs to syst.path so that their contents can be imported (there are .pth files and multi-version support, for example). Those mechanisms are part of setuptools, not of core Python. From a core Python perspective, the path handling is something you do manually.

So while I understand your confusion, I think you should understand that it is a confusion over the setuptools implementation, and how it interacts with the mechanisms defined by core Python (which are defined in terms of zipfiles). So if you feel there are any documentation issues, they should probably be addressed by setuptools rather than in the core docs.

On a peripherally related point, your comment "zipped egg files in sys.path are not found" doesn't really explain your problem very well. When reporting to setuptools, I'd suggest that you need to clarify your problem a bit better - what steps did you take, did they match the steps that the setuptools docs tell you to use, and how did the failure show itself? But as I say, that's for a setuptools bug report.
msg238276 - (view) Author: Thomas Guettler (guettli) Date: 2015-03-17 10:37
The docs should be where new users look.

I don't speak about several hundret words ....

Where do you think new users look for documentation if they want a method which does find a module?
msg238296 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2015-03-17 14:48
Date User Action Args
2015-03-17 14:48:43BreamoreBoysetnosy: + BreamoreBoy
messages: + msg238296
2015-03-17 10:37:55guettlisetmessages: + msg238276
2015-03-17 10:05:02paul.mooresetnosy: + paul.moore
messages: + msg238271
2015-03-17 09:31:09guettlisetmessages: + msg238267
2015-03-12 14:24:50brett.cannonsetmessages: + msg237937
2015-03-11 16:23:06guettlisetnosy: + guettli
messages: + msg237882
2015-03-11 14:59:43brett.cannonsetstatus: open -> closed

assignee: docs@python
components: + Documentation
versions: + Python 2.7
nosy: + brett.cannon, docs@python

messages: + msg237871
resolution: not a bug
2015-03-10 11:14:46Thomas Güttlercreate