I really need webbrowser.open('file://') to open a web browser

Timur Tabi timur at freescale.com
Wed Jan 27 15:31:37 EST 2010


On Wed, Jan 27, 2010 at 12:29 PM, Mitchell L Model <MLMDev at comcast.net> wrote:

> I had some discussions with the Python documentation writers that led to the
> following note being included in the Python 3.1 library documentation for
> webbrowser.open: "Note that on some platforms, trying to open a filename
> using this function, may work and start the operating system’s associated
> program. However, this is neither supported nor portable."

Then they should have renamed the API.  I appreciate that they're
finally documenting this, but I still think it's a bunch of baloney.

> You can control which browser opens the URL by using webbrowser.get to
> obtain a controller for a particular browser, specified by its argument,
> then call the open method on the controller instead of the module.

How can I know which controller (application) the system will use when
it opens an http URL?  I depend on webbrowser.open('http') to choose
the best web browser on the installed system.  Does webbrowser.get()
tell me which application that will be?

> For opening files reliability and the ability to pick a particular program
> (browser or otherwise) to open it with you might have to resort to invoking
> a command line via subprocess.Popen.

But that only works if I know which application to open.

-- 
Timur Tabi
Linux kernel developer at Freescale



More information about the Python-list mailing list