sys.path adjusted?
Jorgen Bodde
jorgen.maillist at gmail.com
Sun Nov 11 02:57:32 PST 2007
Hi all,
I would like to use sys.path[0] as my execution path for my script,
because I cannot rely on my current work dir to be set. But I noticed
that whenever I import wx and use wxversion to check for "2.8" and
up, the sys.path is changed and the wxWidgets installation is set on
the first place. The documentation of Python states that the
sys.path[0] is the execution path of the current script. Wouldn't it
make more sense to insert the wx path after the sys.path[0] entry?
This way the first path element still points to the original execution
path and can be used to determine your relative work directory from.
In wxversion.py I notice that select does;
sys.path.insert(0, bestMatch.pathname)
# q.v. Bug #1409256
path64 = re.sub('/lib/','/lib64/',bestMatch.pathname)
Could this be changed to:
sys.path.insert(1, bestMatch.pathname)
# q.v. Bug #1409256
path64 = re.sub('/lib/','/lib64/',bestMatch.pathname)
Then people do not need to work around the fact that the sys.path[0]
no longer points to the execution path of the current script.
With regards,
- Jorgen
More information about the wxpython-users
mailing list