[New-bugs-announce] [issue11432] webbrowser.open on unix fails.

Campbell Barton report at bugs.python.org
Mon Mar 7 10:30:27 CET 2011

New submission from Campbell Barton <ideasman42 at gmail.com>:

On Linux - tested on: Arch linux @ Debian Squeeze, this fails
 python -c "__import__('webbrowser').open('http://python.org')"

The exception thats raised is:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.2/webbrowser.py", line 70, in open_new_tab
    return open(url, 2)
  File "/usr/lib/python3.2/webbrowser.py", line 62, in open
    if browser.open(url, new, autoraise):
  File "/usr/lib/python3.2/webbrowser.py", line 276, in open
    success = self._invoke(args, True, autoraise)
  File "/usr/lib/python3.2/webbrowser.py", line 239, in _invoke
    stderr=inout, preexec_fn=setsid)
  File "/usr/lib/python3.2/subprocess.py", line 736, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.2/subprocess.py", line 1330, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 9] Bad file descriptor

Noticed that this wont raise an error when stdin arg isn't passed  to Popen:
line 237:
        p = subprocess.Popen(cmdline, close_fds=True, stdin=inout,

Removing tdin=inout makes firefox load ok, however this is there for a reason so its not a useful fix ofcourse.

components: Extension Modules
messages: 130245
nosy: ideasman42
priority: normal
severity: normal
status: open
title: webbrowser.open on unix fails.
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list