[Python-bugs-list] [ python-Bugs-725026 ] Possible OSX module location bug

SourceForge.net noreply@sourceforge.net
Mon, 21 Apr 2003 13:56:38 -0700


Bugs item #725026, was opened at 2003-04-21 10:12
Message generated for change (Comment added) made by logistix
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=725026&group_id=5470

Category: Macintosh
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: logistix (logistix)
Assigned to: Jack Jansen (jackjansen)
Summary: Possible OSX module location bug

Initial Comment:
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

----------------------------------------------------------------------

>Comment By: logistix (logistix)
Date: 2003-04-21 15:56

Message:
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']

----------------------------------------------------------------------

Comment By: Jack Jansen (jackjansen)
Date: 2003-04-21 15:23

Message:
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'.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=725026&group_id=5470