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.

classification
Title: webbrowser.get(command_line) does not support Windows-style path separators
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: dan.oreilly, georg.brandl
Priority: normal Keywords: patch

Created on 2014-07-21 20:16 by dan.oreilly, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
web.patch dan.oreilly, 2014-07-21 20:28 Patch for using posix=False on Windows review
Messages (2)
msg223606 - (view) Author: Dan O'Reilly (dan.oreilly) * Date: 2014-07-21 20:16
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.
msg223609 - (view) Author: Dan O'Reilly (dan.oreilly) * Date: 2014-07-21 20:28
Attached is a patch for the latter approach.
History
Date User Action Args
2022-04-11 14:58:06adminsetgithub: 66224
2017-07-24 01:00:19berker.peksaglinkissue30451 superseder
2014-07-22 16:54:28zach.waresetnosy: + georg.brandl
stage: patch review

versions: - Python 3.1, Python 3.2, Python 3.3
2014-07-21 20:28:18dan.oreillysetfiles: + web.patch
keywords: + patch
messages: + msg223609
2014-07-21 20:16:02dan.oreillycreate