Issue 816810: webbrowser.open hangs under certain conditions (original) (raw)
On Unix, if you have galeon installed and no BROWSER environment variable, webbrowser.open('http://...') will hang if there is no galeon running at the time of the call.
The problem is, webbrowser.open calls "galeon ". If a galeon instance is running, the new invocation will signal the old about the URL and then exit. If there is no galeon instance running, the new instance will do the job itself and not exit, so the call to webbrowser.open() will hang until you exit galeon.
Skip had this to say:
In the meantime, it looks like if you modify the definition of cmd in Galeon._remote to
cmd = "%s %s %s & >/dev/null 2>&1" %
(self.name, raise_opt, action)
that webbrowser.open() should return for you. I'm not sure the '&' is sufficient though. You may lose the Galeon instance if you then exit from the Python interpreter. In general, the code in webbrowser._remote() looks a bit hackish. I'm not sure I like this:
rc = os.system(cmd)
if rc:
import time
os.system("%s >/dev/null 2>&1 &" % self.name)
time.sleep(PROCESS_CREATION_DELAY)
rc = os.system(cmd)
Oh well, it's what we're stuck with...