[Pythonmac-SIG] Newbie path problem

Jack Jansen Jack.Jansen at cwi.nl
Wed Feb 25 17:18:54 EST 2004



> 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.

On 25 Feb 2004, at 20:14, Eric Nieuwland wrote:
> 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.

That is indeed the current situation: the working directory for a 
PythonLauncher-launched script is funny (I think it's / if you run 
without a Terminal window and $HOME if you run with a Terminal window).

But we could of course try to fix this. Is that worth it? And, if we do 
fix it, should the fix be backported to 2.3.X, knowing that 
PythonLauncher is included in Apple's 2.3, where we cannot fix it 
easily with a new version of the MacPython-additions-for-panther 
distribution? Or: can we fix it by including a PythonLauncher with a 
higher version number? Will that override the Apple-supplied one?
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman




More information about the Pythonmac-SIG mailing list