[Python-Dev] Suggestion to Windows- and Mac-library people

Neil Hodgson nhodgson@bigpond.net.au
Sun, 11 Jun 2000 10:04:53 +1000


> Obviously this is not portable off Unix.  Equally obviously it should
> be possible to do an equivalent thing under Windows (at least).  For
> anybody writing interactive programs in this Web-mad era, this
> function is just too useful not to have in the toolbox.  So this is a
> nudge to any Windows and Mac wizards on this list -- let's make this
> function available cross-platform.

   The most common way on Windows to launch the user's preferred browser
with an URL would be:

>>> import win32api
>>> win32api.ShellExecute(0,None,"http://www.python.org",None,"",1)

# Note to Mark - more of the parameters should be optional

   However this, like most process control stuff, requires the Win32
extensions, not the base Python distribution. Trying to hack this up with
os.system would be unpleasant. ShellExecute knows when to do icky stuff like
use DDE to open the correct URL.

   Does this type of UI operation really belong in urllib?

   Neil