[Tutor] use of webbrowser.open_new()

Tom Cloyd tomcloyd at bestmindhealth.com
Mon Aug 8 07:01:04 CEST 2005


Having just discovered the webbrowser module, I've confirmed that I can  
indeed open a URL in my default browser using something like

webbrowser.get_new("{URL}")

What I want to do is open a web page stored on my local machine. I'm not  
getting it to work -

webbrowser.open_new("C:\__Library\folders\05238 Design for Confusion\05238  
Design for Confusion -05krugman.html")
Traceback (most recent call last):
   File "C:\Program Files\ActiveState Komodo  
3.1\dbgp\pythonlib\dbgp\client.py", line 3149, in runcode
     locals = self.frame.f_locals)
   File "C:\Program Files\ActiveState Komodo  
3.1\dbgp\pythonlib\dbgp\client.py", line 1569, in runcode
     h_exec(code, globals=globals, locals=locals, module=module)
   File "C:\Program Files\ActiveState Komodo  
3.1\dbgp\pythonlib\dbgp\client.py", line 516, in __init__
     exec code in globals, locals
   File "<console>", line 0, in __main__
   File "C:\Python24\Lib\webbrowser.py", line 46, in open_new
     get().open(url, 1)
   File "C:\Python24\Lib\webbrowser.py", line 250, in open
     os.startfile(url)
WindowsError: [Errno 2] The system cannot find the file specified:  
'C:\\__Library\x0colders*38 Design for Confusion*38 Design for Confusion  
-05krugman.html'

Can you suggest what I might be doing wrong here?

-- t.

======================================================
Tom Cloyd
Bellingham, Washington, U.S.A: (360) 920-1226
<< BestMindHealth.com / tc at bestmindhealth.com >>
======================================================

Using Opera's revolutionary e-mail client (program):  
http://www.opera.com/mail/


More information about the Tutor mailing list