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

Brendan O'Connor brendano at stanford.edu
Mon Jan 12 14:45:06 EST 2004


Hi wonderful python folks,

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?

-Brendan
(student)

--- webbrowser.py	Mon Jan 12 11:43:26 2004
+++ /usr/lib/python2.2/webbrowser.py	Sun Jul 14 23:33:32 2002
@@ -1,6 +1,4 @@
 """Interfaces for launching and remotely controlling Web browsers."""
-#patched to work on os x native python
-

 import os
 import sys
@@ -299,15 +297,6 @@
     # so don't mess with the default!
     _tryorder = ["internet-config"]
     register("internet-config", InternetConfig)
-
-#
-# Platform support for OS X (builtin unix version)
-# the os x 'open' command opens ANYTHING including url's.
-# ISSUE: what if InternetConfig is present?  Is this OK?
-
-if sys.platform[:6] == 'darwin' and _iscommand("open"):
-    _tryorder = ['open']
-    register("osx", None, GenericBrowser("open %s"))

 #
 # Platform support for OS/2




More information about the Python-Dev mailing list