[New-bugs-announce] [issue22025] webbrowser.get(command_line) does not support Windows-style path separators

Dan O'Reilly report at bugs.python.org
Mon Jul 21 22:16:02 CEST 2014


New submission from Dan O'Reilly:

Currently, when webbrowser.get() is passed a "using" argument that consists of a command line string like "C:\Users\dan\AppData\Local\Google\Chrome\Application\chrome.exe %s", it will use shlex.split(command_line) to tokenize the string. However, when given Windows-style path separators (as is likely to be the case on Windows), shlex.split returns the path with all the separators removed:

>>> cmd = "C:\\Users\\oreild1\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe %s"
>>> shlex.split(cmd)
['C:Usersoreild1AppDataLocalGoogleChromeApplicationchrome.exe', '%s']

Of course, this means the browser object returned is useless. I'm not sure what the preferred way to fix this is: either document that POSIX-style path separators are required (even on Windows), or pass posix=False to shlex.split if we're running Windows.

----------
components: Library (Lib)
messages: 223606
nosy: dan.oreilly
priority: normal
severity: normal
status: open
title: webbrowser.get(command_line) does not support Windows-style path separators
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22025>
_______________________________________


More information about the New-bugs-announce mailing list