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: Forward slashes in Windows paths
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: abarry, doc, docs@python, orsenthil, python-dev, r.david.murray, tim.golden, tim.peters
Priority: normal Keywords:

Created on 2016-05-17 01:33 by doc, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (8)
msg265744 - (view) Author: Ed Doxtator (doc) Date: 2016-05-17 01:33
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.
msg265745 - (view) Author: Anilyka Barry (abarry) * (Python triager) Date: 2016-05-17 01:38
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.
msg265769 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-05-17 16:10
Since windows users expect them to be backslahes, though, what's the motivation for using forward slashes instead?
msg265770 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2016-05-17 16:19
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.
msg265771 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2016-05-17 16:29
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".
msg265772 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2016-05-17 16:35
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>
msg265802 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-18 03:51
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
msg265803 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2016-05-18 03:53
This is fixed and online docs will reflect it when they get built in their next build cycle. 

Thanks for the report.
History
Date User Action Args
2022-04-11 14:58:31adminsetgithub: 71232
2016-05-18 03:53:15orsenthilsetstatus: open -> closed

nosy: + orsenthil
messages: + msg265803

resolution: fixed
stage: needs patch -> resolved
2016-05-18 03:51:24python-devsetnosy: + python-dev
messages: + msg265802
2016-05-17 16:35:06tim.goldensetmessages: + msg265772
2016-05-17 16:29:18tim.peterssetnosy: + tim.peters
messages: + msg265771
2016-05-17 16:25:27zach.waresetstatus: closed -> open
assignee: docs@python
stage: resolved -> needs patch
resolution: not a bug -> (no value)
versions: + Python 3.6
2016-05-17 16:19:47tim.goldensetnosy: + tim.golden
messages: + msg265770
2016-05-17 16:10:24r.david.murraysetnosy: + r.david.murray
messages: + msg265769
2016-05-17 01:38:25abarrysetstatus: open -> closed

assignee: docs@python -> (no value)

nosy: + abarry
messages: + msg265745
resolution: not a bug
stage: resolved
2016-05-17 01:33:25doccreate