sys.path had a '..' at the end, but did not have a ''.   The '..' probably came
from line 19 of CGIWrapper.  Here is the path as displayed by CGIWrapper at the
import failure.  (Note that I have Python 2.1 in the Python20 directory;  I was
running Microsoft PWS and it insisted I keep the Python20 directory name.)

['c:\\PYTHON20\\WEBWARE\\CGIWRA~1', 'c:\\python20\\win32',
'c:\\python20\\win32\\lib', 'c:\\python20\\pythonwin', 'c:\\python20',
'c:\\python20\\dlls', 'c:\\python20\\lib', 'c:\\python20\\lib\\plat-win',
'c:\\python20\\lib\\lib-tk', 'c:\\python20\\mysql', 'c:\\python20\\pil',
'c:\\python20\\ppm', '..']

A curiosity is the above does not have my pythonpath(s) from autoexec.bat
included:
    SET PYTHONPATH=C:\$JWORK\PYTHON;c:\Inetpub\wwwroot\ASSP

Changing my previous CGIWrapper modification to append a '' at the end of
sys.path instead of the full path name works as you expected.

For the record, the interactive window in a fresh copy of PythonWin gives me a
'' at the beginning and no '..'.

>>> sys.path
['', 'c:\\$jwork\\python', 'c:\\inetpub\\wwwroot\\assp', 'c:\\python20\\win32',
'c:\\python20\\win32\\lib', 'c:\\python20\\pythonwin', 'c:\\python20',
'c:\\python20\\dlls', 'c:\\python20\\lib', 'c:\\python20\\lib\\plat-win',
'c:\\python20\\lib\\lib-tk', 'c:\\python20\\mysql', 'c:\\python20\\pil',
'c:\\python20\\ppm']
>>>

And a fresh run of Idle has neither '' nor '..':

Python 2.1 (#15, Apr 19 2001, 10:28:27) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> import sys
>>> sys.path
['C:\\Python20', 'C:\\PYTHON20\\Tools\\idle', 'c:\\$jwork\\python',
'c:\\inetpub\\wwwroot\\assp', 'c:\\python20\\win32',
'c:\\python20\\win32\\lib', 'c:\\python20\\pythonwin', 'c:\\python20',
'c:\\python20\\dlls', 'c:\\python20\\lib', 'c:\\python20\\lib\\plat-win',
'c:\\python20\\lib\\lib-tk', 'c:\\python20\\mysql', 'c:\\python20\\pil',
'c:\\python20\\ppm']
>>>

Finally, saving sys.path from a Python script run from a DOS window also has
neither '' nor '.', but it did insert my script location (c:/$jwork/python)
into the beginning of sys.path. The second and third entries are from my ' set
pythonpath' statement.  If I execute the script using backslashes instead of
forward slashes, the first entry is the same as the second.

['c:/$jwork/python', 'c:\\$jwork\\python', 'c:\\inetpub\\wwwroot\\assp',
'c:\\python20\\win32', 'c:\\python20\\win32\\lib', 'c:\\python20\\pythonwin',
'c:\\python20', 'c:\\python20\\dlls', 'c:\\python20\\lib',
'c:\\python20\\lib\\plat-win', 'c:\\python20\\lib\\lib-tk',
'c:\\python20\\mysql', 'c:\\python20\\pil', 'c:\\python20\\ppm']

Based upon the above, there seems to be a lot of inconsistancy.  I think
CGIWrapper should be changed to append or insert the '' as my import statements
were working under PWS and Apache.  I am not sure my placement makes sense, as
it would happen only if the current working directory is changed.  I am also
confused about the missing paths from my 'set pythonpath' statement.

Roger Haase


Chuck Esterbrook wrote:

> At 07:08 PM 6/13/2001 -0700, haaserd wrote:
> >Can someone clear this up for me?  Should sys.path always be
> >modified instead of using os.chdir?"
> >
> >Roger Haase
>
> Can you print your sys.path for us? What is it's value?
>
> Perhaps it needs a '' or '.' or both at the beginning.
>
> You might also test under 2.0 to see if there is any difference. Generally,
> it is easy to have multiple versions of Python on a system since they go
> into different directories.
>
> -Chuck
>
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/webware-discuss


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to