akabaila at pcug.org.au
Sat Apr 16 12:57:51 CEST 2011
On Saturday 16 April 2011 20:03:22 jmfauth wrote:
> On 16 avr, 06:16, harrismh777 <harrismh... at charter.net> wrote:
> > By default the sys.path always shows the directory python
> > was opened in, usually the users home directory. With
> > .profile you can set the path any way you want... most
> > useful for setting up special test directories ahead of
> > the "real" code, or for setting up separate directories
> > for versions--- one for Python26, Python27, and of course
> > Python32.
> > (there are other ways of accomplishing the same thing, and
> > of course, this one only really works with *nix systems---
> > windows is another mess entirely)
> I belong to those who are very happy with the Python
> installations on Windows platform (thanks MvL, this should
> be said) and I hope it will continue like this.
> I do not see any mess here. Every Python version lives in
> its own isolated directory, including \site-packages.
> That means I can keep, eg, a Python 2.5 application (*) which
> is using PIL, wxPython and numpy in a running state, while
> developping new applications with other Python versions or
> porting that application (*) to another Python version. And
> that on all Windows versions (Win2K, XP, Vista, Win7) modulo
> the underlaying os-libs compatibility, but that's the same
> problem on all os, especially for the GUI libs.
> I'm using Python since ver 1.5.6 and I never set any
> PYTHONPATH environment variable.
> A final word about sys.path. This is is my mind the
> most clever idea of Python. I have the feeling, no
> offense here, you are not understanding it very well.
> The sys.path is some kind of *dynamic* environment
> variable and has basically or primarily nothing to do
> with a user directory.
On invocation of IDLE, sys.path does contain the path to home
directory (on nix /home/<name>; on my PC it is /home/ak) In
Bash that home directory is accessible through bash variable
$HOME. Once a program is executed from the "Python Shell" (of
IDLE), the $HOME directory is replace by the directory of the
program, whatever that is. Yes, sys.path is dynamic and it can
be easily changed from Python, but the changes are discarded
once the Python is restarted. Hence my interest in shell
variable PYTHONPATH, accessible from bash as $PYTHONPATH.
I have no need of Windows and no longer use it at all, yet I
want my programs to be portable to all main platforms, hence my
enthusiastic support for all things Python.
Thanks for all contributions and ALL includes windows et al.
More information about the Python-list