webbrowser.open still gives problem with file://

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Nov 13 03:11:24 EST 2007


En Mon, 12 Nov 2007 16:18:06 -0300, krishnakant Mane  
<researchbase at gmail.com> escribió:

> some days bac I posted a problem about webbrowser.open() not opening
> the file on the local machine.
> I get a few responses and I tryed working it out.
> I also refered to the cookbook example posted on that thread.
> I still can't figure out why
> webbrowser.open("file:///home/krishna/documents/tut.html") does not
> open the file.
> as I mentioned earlier the url in the addressbar of mozilla firefox 3
> alpha is "file:///home/krishna/"/home/krishna/documents/tut.html"
> which is indeed wrong.

I can think of two alternatives:
1) omit the file: protocol, and just use the absolute file path, like  
webbrowser.open("/home/krishna/documents/tut.html")
2) use this recipe  
<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/347810> which  
lets you display content inside a browser window without requiring a  
temporary file.

-- 
Gabriel Genellina




More information about the Python-list mailing list