[ python-Bugs-1507224 ] sys.path issue if sys.prefix contains a colon

SourceForge.net noreply at sourceforge.net
Sun Jun 25 12:04:56 CEST 2006


Bugs item #1507224, was opened at 2006-06-16 11:22
Message generated for change (Comment added) made by arigo
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1507224&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Ronald Oussoren (ronaldoussoren)
Assigned to: Nobody/Anonymous (nobody)
Summary: sys.path issue if sys.prefix contains a colon

Initial Comment:
If you install python in a directory whose path contains a colon sys.path 
will be wrong, the installation directory will be split into two strings and 
both of them are added to sys.path.

The following session demonstrates the problem:

bump:~/src/python/:colon bob$ ./python.exe -c "import sys; print 
sys.path"
'import site' failed; use -v for traceback
['', '/usr/local/lib/python25.zip', '/Users/bob/src/python/', 'colon/../
Lib/', '/Users/bob/src/python/', 'colon/../Lib/plat-darwin', '/Users/bob/
src/python/', 'colon/../Lib/plat-mac', '/Users/bob/src/python/', 'colon/../
Lib/plat-mac/lib-scriptpackages', '/Users/bob/src/python/', 'colon/../
Lib/lib-tk', '/Users/bob/src/python/', 'colon/Modules']



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

>Comment By: Armin Rigo (arigo)
Date: 2006-06-25 10:04

Message:
Logged In: YES 
user_id=4771

Internally, CPython sets up its path using a single
':'-separated string.  I have no clue how, on Posix, you are
supposed to use paths containing ':' in environment variables
like $PATH - escape the colons somehow?

If there is some escape mechanism, we could support it,
both as an internal way to fix the present issue, and
directly in parsing PYTHONPATH.  If there is no such
mechanism, then I can only conclude that having colons in
paths will make many other things unhappy, not just Python.

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

Comment By: Martin v. Löwis (loewis)
Date: 2006-06-24 10:35

Message:
Logged In: YES 
user_id=21627

I think this can be fixed. sys.prefix should be treated as
unspittable when constructing sys.path, i.e. sys.prefix
should be inserted only after the colon-splitting has been done.

Not sure what the best way to implement that would be,
though, so unassigning.

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

Comment By: Georg Brandl (gbrandl)
Date: 2006-06-22 19:08

Message:
Logged In: YES 
user_id=849994

I don't know if something can be done here. A possibility
would be, if one path segment doesn't exist, add the colon
and the next segment and try again. Martin, do you have an
opinion?

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

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


More information about the Python-bugs-list mailing list