[Python-Dev] patching webbrowser.py for OS X

Bob Ippolito bob at redivi.com
Mon Jan 12 15:16:10 EST 2004


On Jan 12, 2004, at 2:59 PM, Alex Martelli wrote:

>
> On Jan 12, 2004, at 8:45 PM, Brendan O'Connor wrote:
>
>> I was trying to use the webbrowser module with OS X's preinstalled
>> python; I'm not very familiar with OS X, but I just patched 
>> webbrowser.py
>> to use the very generic "open" command, which works for the simple
>> webbrowser.open(url).
>>
>> I've heard that Fink or another port would be more complete; on the 
>> other
>> hand, I'm using computers where I can't install software myself, so 
>> this
>> is useful for me.
>>
>> Any thoughts or issues?
>
> As a brand-new user of Mac OS X, "open" appears to be the right 
> solution to me, picking up whatever settings one may have made for a 
> different browser than Safari, not requiring fink, etc, etc.  However, 
> we should probably double-check on pythonmac-sig, where the REAL Mac 
> Pythonistas hang out...

I don't think that this patch is necessary..  On my Mac OS X 10.3 
machine (comes with Python 2.3.0), webbrowser.py uses Internet Config 
to launch the url (the 'ic' module).  This is basically equivalent to 
the open command.  It works like this:
	* Internet Config is an old MacOS API that's mapped to Launch Services 
which launches the URL with your preferred browser
	* open is a command line utility that uses the NSWorkspace Cocoa API 
which uses Launch Services to launch the URL with your preferred 
browser

I don't think your patch fixes anything, it's launched by Launch 
Services either way.. at least on OS X 10.3.  A patch doesn't do us any 
good against Python 2.2.0 on Mac OS 10.2 if its behavior is broken.  
Apple doesn't update Python between major releases.

You should be able to install MacPython 2.3 in your home directory.  
Don't bother with Fink.

-bob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2357 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20040112/00c44b7d/smime-0001.bin


More information about the Python-Dev mailing list