Issue 725026: Possible OSX module location bug (original) (raw)

I have an app with a testfile 'os.py' that was designed to see if I was searching pythonpath properly (if it found my os.py, it didn't)

Running scripts from the directory containing this file has been working fine on Windows, BSD, Linux.

An OSX user reported an error trying to run the scripts.
Output indicated that site.py was trying to load my os.py instead of the proper one.

I can't reproduce it since I don't have OSX, but if someone wants to try:

Create a subdirectory under site-packages Create a dummy os.py file Create a dummy test.py file with this directory as the pwd, issue 'python -v test.py'

User didn't appear to have anything too funky in sys.path

Logged In: YES user_id=45365

I tried this with all three of

None of these see os.py in the current directory. The only thing I can imagine, because you talk about a subdirectory of site-packages, is that the user has a .pth file in site-packages listing the subdirectory.

If this isn't the case, ask for the following:

Logged In: YES user_id=699438

Here's what he sent me before.
Actually, '/Volumes/Other/dev/python' might be the culprit.
I'm not sure what working directory the commands were run under.

I'll go ahead and forward a link to this bug to him. Unless he has any input, I guess it's "Works for Me".

python -v buildWeb.py

/usr/lib/python2.2/site.pyc

matches /usr/lib/python2.2/site.py import site # precompiled from /usr/lib/python2.2/site.pyc # ./os.pyc matches ./os.py import os # precompiled from ./os.pyc Ugh! 'import site' failed; traceback: Traceback (most recent call last): File "/usr/lib/python2.2/site.py", line 69, in ? m.file = os.path.abspath(m.file) AttributeError: 'module' object has no attribute 'path' Python 2.2 (#1, 07/14/02, 23:25:09) [GCC Apple cpp-precomp 6.14] on darwin Type "help", "copyright", "credits" or "license" for more information. ...

% python -c "import sys;print sys.path" ['', '/Volumes/Other/dev/python', '/usr/lib/python2.2', '/usr/lib/python2.2/plat-darwin', '/usr/lib/python2.2/lib-tk', '/usr/lib/python2.2/lib-dynload', '/usr/lib/python2.2/site- packages']