Issue 8812: Show package path in repr string for packages installed to user site (original) (raw)

Created on 2010-05-24 21:00 by srid, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg106391 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-05-24 21:00
I see this in Python 2.7. No idea if this is a regression, mere future request, but doesn't it make sense to print the value `__path__` in the repr string? >>> import paste >>> paste <module 'paste' (built-in)> >>> paste.__path__ ['/home/sridharr/.local/lib/python2.7/site-packages/paste'] It does for stdlib packages/modules: >>> import xml >>> xml <module 'xml' from '/opt/ActivePython-2.7/lib/python2.7/xml/__init__.pyc'> Happens on Windows, Linux and Mac using Python 2.7 hg hash eaeebf8cda33.0.
msg106399 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-05-24 21:44
You are mistaken. It doesn't include __path__ into repr, but __file__. It prints "(built-in)" if the filename is not set for some reason.
msg106400 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-05-24 21:48
On 2010-05-24, at 2:44 PM, Martin v. Löwis wrote: > You are mistaken. It doesn't include __path__ into repr, but __file__. It prints "(built-in)" if the filename is not set for some reason. Ok. Why is __file__ not set for modules/packages installed to user site (~/.local/), but not stdlib? Is this a bug? Ah, I see that a "__init__.py" is missing in these packages. Strange; gotta see how that happened in first place .. (even stranger that I can actually import these directories...)
msg106405 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-05-24 22:46
Can you please provide a reproducible bug report? I have no idea what "paste" is or how it got into your .local folder. Please structure the bug report as follows: 1. this is what you did 2. this is what happened 3. this is what you expected to happen instead Installing http://pypi.python.org/pypi/Paste through distribute's setup.py install --user, I get py> paste <module 'paste' from '/home/martin/.local/lib/python/2.7/site-packages/Paste-1.7.3.1-py2.7.egg/paste/__init__.pyc'>
msg106406 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-05-24 23:01
On 2010-05-24, at 3:46 PM, Martin v. Löwis wrote: > Can you please provide a reproducible bug report? I have no idea what "paste" is or how it got into your .local folder. Please structure the bug report as follows: > > 1. this is what you did > 2. this is what happened > 3. this is what you expected to happen instead I was not sure if this is a bug .. which is why I was waiting till the completion of my investigation ... > > Installing http://pypi.python.org/pypi/Paste through distribute's setup.py install --user, I get > > py> paste > <module 'paste' from '/home/martin/.local/lib/python/2.7/site-packages/Paste-1.7.3.1-py2.7.egg/paste/__init__.pyc'> This is what I found: setuptools/Distribute does some namespace magic to make these namespace packages work in the absence of __init__.py. You should be able to reproduce this with --root option (or --single-version-multi-installed or some such thing) in "setup.py install" command to prevent .egg'fying the installed packages. So this is not a bug in Python; it is an expected behaviour of setuptools-installed packages that do not use .egg/ package structure.
History
Date User Action Args
2022-04-11 14:57:01 admin set github: 53058
2010-05-24 23:02:40 srid set status: open -> closed
2010-05-24 23:01:46 srid set messages: +
2010-05-24 22:46:40 loewis set messages: +
2010-05-24 21:48:34 srid set status: pending -> openmessages: +
2010-05-24 21:44:53 loewis set status: open -> pendingnosy: + loewismessages: + resolution: not a bug
2010-05-24 21:00:28 srid create