[Pythonmac-SIG] Newbie path problem

Eric Nieuwland eric.nieuwland at xs4all.nl
Wed Mar 3 15:09:40 EST 2004


On 25-feb-04, at 23:18, Jack Jansen wrote:
>> 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?

Just fix it, I would say. If you can do it now: great! If it has to 
wait a little: great as well! We'll just need to be patient ;-)

--eric




More information about the Pythonmac-SIG mailing list