[Pythonmac-SIG] webbrowser.py

Tony Lownds tony at lownds.com
Sat Jul 19 10:16:40 EDT 2003


At 11:00 AM -0400 7/19/03, Joe Heafner wrote:
>Hi.
>I'm running Python2.2 as supplied by the Fink project. I need Python 
>so I can use VPython (http://www.vpython.org) for the physics 
>courses I teach. My Macs run OS X 10.2.6 and Apple's X11 Beta 3. 
>VPython comes with IDLE_fork as a programming IDE. The VPython folks 
>suggested I post my query here.
>
>The problem is webbrowser.py. In IDLE_fork, pressing F1 is supposed 
>to bring up documentation. It works under Windows but not under OS 
>X. The problem seems to be that webbrowser.py doesn't know how to 
>bring up the default browser under OS X. I use Safari 1.0. I've 
>searched through various archives and have found nothing, at least 
>nothing that I can claim to understand and I've certainly seen no 
>mention of Safari. So, my two questions are as follows:
>
>1) Can someone please tell me how to get webbrowser.py working under OS X?


Set the environment variable BROWSER=open before you launch VPython

The "open" command knows how to open URLs, and setting BROWSER will 
teach webbrowser.py how to use it.

Or is setting environment variables is a pain you can add this to site.py

import webbrowser
webbrowser.register('open', webbrowser.GenericBrowser("open '%s'"))
webbrowser._tryorder.append('open')


Hope this helps

-Tony



More information about the Pythonmac-SIG mailing list