Matthias Klose <[EMAIL PROTECTED]> writes:
>Henrik Holmboe writes:
>> PYTHONPATH should behave like PATH according to section 6.1.1 (see URL
>> below) of the Python Tutorial. But I have found that it doesnt
>> properly expand ~ (tilde) to the home directory.
>>
>> A workaround is to use ${HOME} instead of ~, but both should work as
>> advertised.
>>
>> <http://docs.python.org/tut/node8.html#SECTION008110000000000000000>
>
>no, you' never see ~ in PATH as well. It's expanded by the shell. Same
>with PYTHONPATH, which gets exanded by the shell, not python.
Incorrect.
I set both $PATH and $PYTHONPATH in .bashrc, and after some testing it
seems that bash doesnt expand tilde at the time of reading .bashrc if
its enclosed in quotes (which I currently do), but it is expanded on
the fly (works with tab-completion etc). So the conclusion is that
Python doesnt expand tilde in $PYTHONPATH, but relies on that the
variable is already expanded by the shell. Hence that $PYTHONPATH
doesnt behave like $PATH.
1)
$ grep PATH .bashrc
export
PATH="~/profile/bin:/usr/local/bin:/usr/bin:/usr/games:/usr/bin/X11:/bin"
$ echo $PATH
~/profile/bin:/usr/local/bin:/usr/bin:/usr/games:/usr/bin/X11:/bin
2)
$ grep PATH .bashrc
export
PATH=~/profile/bin:/usr/local/bin:/usr/bin:/usr/games:/usr/bin/X11:/bin
$ echo $PATH
/home/hh/profile/bin:/usr/local/bin:/usr/bin:/usr/games:/usr/bin/X11:/bin
Both $PYTHONPATH and $PATH can use $HOME when exporting, since that is
always expanded, with or without quotes.
--
Henrik Holmboe, Stockholm, Sweden
<http://henrik.holmboe.se/contact/>
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]