[Tutor] Launching a file browser

Mike Hall michael.hall at critterpixstudios.com
Fri Apr 1 03:06:34 CEST 2005


Ah, so it has to do with access to the window manager. That answers a 
lot, thanks.


On Mar 31, 2005, at 4:09 PM, Max Noel wrote:

>
> On Apr 1, 2005, at 00:14, Mike Hall wrote:
>
>> On Mar 31, 2005, at 12:21 AM, Max Noel wrote:
>>
>>>> It's been too long since I used Python on MacOSX, but IIRC you 
>>>> can't just run a Python GUI program from the shell. Or something 
>>>> like that...you should ask this one on the python-mac SIG mailing 
>>>> list:
>>>> http://www.python.org/sigs/pythonmac-sig/
>>>>
>>>> Kent
>>>
>>> 	You have to launch your script with pythonw, not with python.
>>
>> I'm unclear on why a command like webbrowser.open() will comfortably 
>> launch your default web browser (in my case Safari), but something as 
>> ubiquitous to an OS as a file browser has special needs to launch. 
>> Perhaps each application has custom written their file browser, and 
>> I'm assuming they are each essentially doing system calls to the same 
>> thing...?
>
> 	No, the reason for that, IIRC, is that for the program to be able to 
> interact with the window manager, it has to be launched with pythonw. 
> When the program starts to display stuff elsewhere than in STDOUT or 
> STDERR, an application launch is somehow triggered (icon appears in 
> the Dock), which for some reason enables the user to interact with the 
> program.
> 	Launching a web browser requires no interaction whatsoever with the 
> WM, and can therefore be done with python.
>
> 	Yes, the python/pythonw distinction in Mac OS X is stupid, I'll give 
> you that. I don't even know why it exists in the first place.
>
> -- Max
> maxnoel_fr at yahoo dot fr -- ICQ #85274019
> "Look at you hacker... A pathetic creature of meat and bone, panting 
> and sweating as you run through my corridors... How can you challenge 
> a perfect, immortal machine?"
>
>
>
>
-MH



More information about the Tutor mailing list