webbrowser module's Firefox support

Dustan DustanGroups at gmail.com
Sat Sep 23 19:25:36 EDT 2006


MonkeeSage wrote:
> Dustan wrote:
> > I did do a search here, but came up empty-handed. Can anyone tell me
> > how to get the webbrowser module to recognize firefox's existence,
> > given this information?
>
> Looks like it is checking %PATH% for firefox.exe. Try:
>
> >>> import os
> >>> os.environ["PATH"] = r"C:\Program Files\Mozilla Firefox;"
> >>> import webbrowser
> >>> webbrowser._browsers
>
> Regards,
> Jordan

Thanks! But I'm still getting an error message:

>>> import webbrowser
>>> webbrowser._browsers
{'windows-default': [<class 'webbrowser.WindowsDefault'>, None],
'firefox': [None, <webbrowser.BackgroundBrowser object at 0x00BAC8D0>]}
>>> cont=webbrowser._browsers['firefox'][1]
>>> cont
<webbrowser.BackgroundBrowser object at 0x00BAC8D0>
>>> cont.open("http://www.google.com")

Traceback (most recent call last):
  File "<pyshell#10>", line 1, in <module>
    cont.open("http://www.google.com")
  File "C:\Python25\lib\webbrowser.py", line 185, in open
    p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid)
  File "C:\Python25\lib\subprocess.py", line 551, in __init__
    raise ValueError("close_fds is not supported on Windows "
ValueError: close_fds is not supported on Windows platforms

Looking in the docs on subprocess.Popopen
(http://docs.python.org/lib/node529.html), it says "If close_fds is
true, all file descriptors except 0, 1 and 2 will be closed before the
child process is executed. (Unix only)". I have to be frank; I have no
idea what this means. What should I do to fix this?




More information about the Python-list mailing list