Re: webbrowser.open still gives problem with file://

2007-11-14 Thread Greg Couch
Gabriel Genellina [EMAIL PROTECTED] writes:

En Mon, 12 Nov 2007 16:18:06 -0300, krishnakant Mane  
[EMAIL PROTECTED] 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

You didn't say which platform you're on.  I found that on older Mac OS X
systems that one needs to give file://localhost/path instead of file:///path
but the localhost version didn't always work on other platforms.  The other
thing you need to do is to use Python 2.5's version of webbrowser.py instead
of the earlier ones.  It's easy to backport and works *much* better.

Greg Couch
UCSF Computer Graphics Lab
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: webbrowser.open still gives problem with file://

2007-11-13 Thread Gabriel Genellina
En Mon, 12 Nov 2007 16:18:06 -0300, krishnakant Mane  
[EMAIL PROTECTED] 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

-- 
http://mail.python.org/mailman/listinfo/python-list


webbrowser.open still gives problem with file://

2007-11-12 Thread krishnakant Mane
hello,
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 have only got a hint so far that I can use a module called
BaseHTTPServer but I have not yet understood how it will help me to
solve the problem.
is it going to give the correct file:/// to the webbrowser.open()?
if yes then how?
can some one post a simple example?
I don't need to create any class for this because some other code in
python is actually creating an html file and I just need to display it
in the browser.
so please help on this one.
with regards,
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list