[issue23945] webbrowser.open opens twice on Windows if BROWSER is set

2015-04-14 Thread andig2

New submission from andig2:

Setup: IE default browser, FF37 preferred browser and configured in BROWSER env 
variable

Test:

import webbrowser
url = http://localhost;
webbrowser.open(url + '?XDEBUG_SESSION_START=sublime.xdebug')

Behaviour:

1st run: FF opens - ok
2nd run: FF opens new tab - ok, in addition, IE opens - WRONG

--
components: Library (Lib)
messages: 240863
nosy: andig2
priority: normal
severity: normal
status: open
title: webbrowser.open opens twice on Windows if BROWSER is set
type: behavior
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23945
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23945] webbrowser.open opens twice on Windows if BROWSER is set

2015-04-14 Thread andig2

andig2 added the comment:

And finally: FF returns exit code 1 when its started and already running. That 
situation is not handled by the GenericBrowser Popen logic.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23945
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23945] webbrowser.open opens twice on Windows if BROWSER is set

2015-04-14 Thread andig2

andig2 added the comment:

Here is a matrix of the test results depending on which browser is open upon 
starting the test script:

No browser open: FF opens tab (ok)
IE open: new tab in FF (ok), nothing in IE (ok)
FF open: new tab in FF (ok), new tab in in IE (NOT ok)
Both open: new tab in FF (ok), new tab in in IE (NOT ok)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23945
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23945] webbrowser.open opens twice on Windows if BROWSER is set

2015-04-14 Thread andig2

andig2 added the comment:

Looking further in webbrowser.py, FF uses GenericBrowser:

class GenericBrowser(BaseBrowser):
Class for all browsers started with a command
   and without remote functionality.

   ...

def open(self, url, new=0, autoraise=True):
cmdline = [self.name] + [arg.replace(%s, url)
 for arg in self.args]
try:
if sys.platform[:3] == 'win':
p = subprocess.Popen(cmdline)
else:
p = subprocess.Popen(cmdline, close_fds=True)
return not p.wait()

If FF is already open, Popen.wait() returns TRUE for FF but FALSE for IE. This 
leads to fallthrough for FF and then calling open for IE.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23945
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23945] webbrowser.open opens twice on Windows if BROWSER is set

2015-04-14 Thread andig2

andig2 added the comment:

It boils down to Popen.wait() returning 1 if FF is already open resulting in 
GenericBrowser.open() returning False.

That part was last touched here 
https://github.com/python/cpython/commit/a456db5e058f955f235fe7a51e8c111d0a8ecf4e

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23945
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23945] webbrowser.open opens twice on Windows if BROWSER is set

2015-04-14 Thread andig2

andig2 added the comment:

Last but not least: this is due to using BROWSER for defining the executable 
path. 

Workaround: set BROWSER=firefox and add firefox to path.

--
resolution:  - not a bug
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23945
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com