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: Possible OSX module location bug
Type: Stage:
Components: macOS Versions:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: jackjansen Nosy List: jackjansen, logistix
Priority: normal Keywords:

Created on 2003-04-21 15:12 by logistix, last changed 2022-04-10 16:08 by admin. This issue is now closed.

Messages (3)
msg15559 - (view) Author: Grant Olson (logistix) Date: 2003-04-21 15:12
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
msg15560 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2003-04-21 20:23
Logged In: YES 
user_id=45365

I tried this with all three of
- Apple's /usr/bin/python 2.2
- Python 2.3a2+ from CVS
- MacPython-OS9 2.3a2+ from CVS

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:
- Complete version info (python startup banner)
- sys.path value
- output of 'python -v test.py'.
msg15561 - (view) Author: Grant Olson (logistix) Date: 2003-04-21 20:56
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']
History
Date User Action Args
2022-04-10 16:08:16adminsetgithub: 38343
2003-04-21 15:12:44logistixcreate