This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author schmichael
Recipients schmichael
Date 2008-12-04.21:49:08
SpamBayes Score 4.822702e-06
Marked as misclassified No
Message-id <1228427350.73.0.444727846196.issue4537@psf.upfronthosting.co.za>
In-reply-to
Content
On the joyous occasion of Python 3000's release my friends & I were
playing with "import antigravity" and it failed for someone with the
following traceback (anonymized):

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/.../lib/python3.0/antigravity.py", line 4, in <module>
    webbrowser.open("http://xkcd.com/353/")
  File "/.../lib/python3.0/webbrowser.py", line 61, in open
    if browser.open(url, new, autoraise):
  File "/.../lib/python3.0/webbrowser.py", line 275, in open
    success = self._invoke(args, True, autoraise)
  File "/.../lib/python3.0/webbrowser.py", line 226, in _invoke
    inout = open(os.devnull, "r+")
  File "/.../lib/python3.0/webbrowser.py", line 61, in open
    if browser.open(url, new, autoraise):
  File "/.../lib/python3.0/webbrowser.py", line 271, in open
    "expected 0, 1, or 2, got %s" % new)
webbrowser.Error: Bad 'new' parameter to open(); expected 0, 1, or 2, got r+

I believe the following patch (against branches/release30-maint) fixes
it cleanly:

Index: Lib/webbrowser.py
===================================================================
--- Lib/webbrowser.py	(revision 67538)
+++ Lib/webbrowser.py	(working copy)
@@ -8,6 +8,7 @@
 import stat
 import subprocess
 import time
+import builtins
 
 __all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"]
 
@@ -223,7 +224,7 @@
         cmdline = [self.name] + raise_opt + args
 
         if remote or self.background:
-            inout = open(os.devnull, "r+")
+            inout = builtins.open(os.devnull, "r+")
         else:
             # for TTY browsers, we need stdin/out
             inout = None
History
Date User Action Args
2008-12-04 21:49:10schmichaelsetrecipients: + schmichael
2008-12-04 21:49:10schmichaelsetmessageid: <1228427350.73.0.444727846196.issue4537@psf.upfronthosting.co.za>
2008-12-04 21:49:09schmichaellinkissue4537 messages
2008-12-04 21:49:08schmichaelcreate