Hello tutors,

This programm works:
**********
import webbrowser
a = open('test.htm','wb')
a.write("<html>Test</html>")
webbrowser.open(a.name)
a.close()
***********
but I would like to avoid the risk of overwriting an already existing
"test.htm" file, so I try to use the module tempfile:
***********
import tempfile
import webbrowser
a = tempfile.NamedTemporaryFile('w+b',-1,'.html')
a.write("<html>Test</html>")
webbrowser.open(a.name)
#a.close()
**********
This does not work (no traceback error though): the browser displays a
blank page.
I am using Python2.3.3 on Windows XP, and Firefox.

Have you got some suggestions to tackle this problem?

-- 
Yves Egrix
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to