[Pythonmac-SIG] Newbie path problem
Eric Nieuwland
eric.nieuwland at xs4all.nl
Wed Feb 25 14:14:14 EST 2004
Hi Martin,
When starting an application by double-clicking it or one of its files,
the working directory should be considered undefined for any practical
purpose. In this case that means you'll need to figure out where your
Python script lives first. After os.chdir() to that directory, your
code should work as expected.
--eric
On 25-feb-04, at 10:30, LALOUX Martin wrote:
> I am new in Macpython (Panther, working in win32 python) and i have a
> problem with paths. When I launch a script (doubleclicking the .py
> file -> PythonLauncher) which needs to open a file located in the same
> directory, I have a message which says "file" not found.
> When i launch the same script from terminal (cd..directory), no
> problem.
> I wrote a small script which gives me the path of my script when I
> launch it and here the results:
> "with PythonLauncher:
> martin $ "/usr/bin/pythonw"
> "/Users/martin/Documents/pythondivers/documentation/PySource/
> testpath.py" && echo Exit status: $? && exit 1
> path: /Users/martin
> pythonpath:
> directly from terminal :
> PySource $ python testpath.py
> path: /Users/martin/Documents/pythondivers/documentation/PySource
> pythonpath: "
>
> What can I do because this problem is very annoying ?
> Thank-you very much
> Martin Laloux _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
More information about the Pythonmac-SIG
mailing list