I really need webbrowser.open('file://') to open a web browser
Jonathan Temple
jonntemple at googlemail.com
Sat Jan 16 12:08:27 EST 2010
On Jan 15, 8:14 pm, Timur Tabi <ti... at freescale.com> wrote:
> After reading several web pages and mailing list threads, I've learned
> that the webbrowser module does not really support opening local
> files, even if I use a file:// URL designator. In most cases,
> webbrowser.open() will indeed open the default web browser, but with
> Python 2.6 on my Fedora 10 system, it opens a text editor instead. On
> Python 2.5, it opens the default web browser.
>
> This is a problem because my Python script creates a local HTML file
> and I want it displayed on the web browser.
>
> So is there any way to force webbrowser.open() to always use an actual
> web browser?
>
> --
> Timur Tabi
> Linux kernel developer at Freescale
Might not be useful, but trying open_new_tab() on...
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import webbrowser as wb
>>> x = wb.get()
>>> x.basename
'gnome-open'
When attempting to use open_new_tab(), I get:
file:///home/jon/blahblah.html - opens in Firefox
file:///home/jon/blahblah.txt - opens in gedit
Jon.
More information about the Python-list
mailing list