[issue27045] Forward slashes in Windows paths
New submission from Ed Doxtator: In the documentation for pyvenv (https://docs.python.org/dev/library/venv.html), there is a table that shows by platform the command required to activate a virtual environment by OS. For Windows, the values are: Platform Shell Command to activate virtual environment ------------------------------------------------------------------- Windows cmd.exe C:> <venv>/Scripts/activate.bat PowerShell PS C:> <venv>/Scripts/Activate.ps1 The commands are incorrect-- they contain forward slashes and should be back slashes. ---------- assignee: docs@python components: Documentation messages: 265744 nosy: doc, docs@python priority: normal severity: normal status: open title: Forward slashes in Windows paths type: enhancement versions: Python 3.5 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27045> _______________________________________
Emanuel Barry added the comment: Forward slashes work fine in Windows, for both the command line and PowerShell. Windows always displays backslahes, but accepts either (as well as any combination of both) in paths. ---------- assignee: docs@python -> nosy: +ebarry resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27045> _______________________________________
R. David Murray added the comment: Since windows users expect them to be backslahes, though, what's the motivation for using forward slashes instead? ---------- nosy: +r.david.murray _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27045> _______________________________________
I haven't tested everywhere but some versions of Windows don't in fact accept forward slashes on the cmd.exe command line. Suggest changing to backslashes as there's no reason to do otherwise.
Changes by Zachary Ware <zachary.ware@gmail.com>: ---------- assignee: -> docs@python resolution: not a bug -> stage: resolved -> needs patch status: closed -> open versions: +Python 3.6 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27045> _______________________________________
Tim Peters added the comment: All versions of cmd.exe want backslashes in paths for the commands implemented _by_ cmd.exe - those interpret a forward slash as indicating an option. For example, here on Win10 Pro: C:\WINDOWS\system32>dir c:\Windows\System32\xwreg.dll Volume in drive C is OS Volume Serial Number is 5E8B-CFAC Directory of c:\Windows\System32 10/30/2015 02:17 AM 120,320 xwreg.dll 1 File(s) 120,320 bytes 0 Dir(s) 2,880,244,813,824 bytes free `dir` is implemented by cmd.exe, so that example doesn't work with forward slashes: C:\WINDOWS\system32>dir c:/Windows/System32/xwreg.dll Parameter format not correct - "Windows". ---------- nosy: +tim.peters _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27045> _______________________________________
Tim Golden added the comment: The key point here is that if I run the example as given on my Win 8.1 box, it doesn't work. (The venv I'm using is called nw0). d:\tim\.venvs>dir nw0\Scripts\activate.bat Volume in drive D is New Volume Volume Serial Number is 2639-22DA Directory of d:\tim\.venvs\nw0\Scripts 30/03/2016 07:45 547 activate.bat 1 File(s) 547 bytes 0 Dir(s) 458,354,536,448 bytes free d:\tim\.venvs> d:\tim\.venvs>nw0/Scripts/activate.bat 'nw0' is not recognized as an internal or external command, operable program or batch file. d:\tim\.venvs> ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27045> _______________________________________
Roundup Robot added the comment: New changeset e6e35ff744fe by Senthil Kumaran in branch '3.5': issue27045 - Use backslash in windows path to script file. https://hg.python.org/cpython/rev/e6e35ff744fe New changeset 2173063cbae8 by Senthil Kumaran in branch 'default': merge from 3.5 https://hg.python.org/cpython/rev/2173063cbae8 ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27045> _______________________________________
Senthil Kumaran added the comment: This is fixed and online docs will reflect it when they get built in their next build cycle. Thanks for the report. ---------- nosy: +orsenthil resolution: -> fixed stage: needs patch -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27045> _______________________________________
participants (9)
-
Ed Doxtator -
Emanuel Barry -
R. David Murray -
Roundup Robot -
Senthil Kumaran -
Tim Golden -
Tim Golden -
Tim Peters -
Zachary Ware