The format of filename
Tim Chase
python.list at tim.thechases.com
Thu Oct 26 09:04:45 EDT 2006
>> Some experimentation shows that Python does seem to provide
>> *some* translation. Windows lets me use '/' as a path separator,
>> but not as the name of the root of a partition name. But perhaps
>> this a peculiarity of the commands themselves, and not of Windows
>> path names in particular.
>>
>> C:\PYTHON24>CD /
>> The syntax of the command is incorrect.
>>
>> C:\PYTHON24>CD \
>> C:\>EDIT /PYTHON24/README
>> The syntax of the command is incorrect.
>
> The Windows APIs all accept either forward slashes or back, and have done
> so clear back to Windows 3.0. However, the Windows command shells do not.
> That's what you're seeing here.
What one finds is that the command-shell is self-inconsistant:
C:\temp>md foo
C:\temp>md foo\bar
C:\temp>cd foo/bar
C:\temp\foo\bar>cd ..
C:\temp\foo>cd ..
C:\temp>cd /foo/bar
C:\temp\foo\bar>cd \temp
C:\temp>md foo/baz
The syntax of the command is incorrect
C:\temp>echo dir > foo/bar/pip
C:\temp>echo dir > /foo/bar/pip
The system cannot find the path specified.
C:\temp>dir foo/bar
Parameter format not correct - "bar".
C:\temp>dir /b foo\bar
pip
C:\temp>type foo/bar/pip
The syntax of the command is incorrect.
C:\temp>type foo\bar\pip
dir
C:\temp>cmd < foo/bar/pip
[directory listing within a subshell]
C:\temp>cmd < /foo/bar/pip
The system cannot find the path specified.
The CD, MD, TYPE, ECHO and redirection are all shell-builtins,
yet they seem to be conflictingly quasi-smart about forward slashes.
Sometimes leading slashes matter. Sometimes they don't.
Sometimes forward slashes are acceptable. Sometimes they aren't.
All within the shell's built-in mechanisms. Go figure.
-tkc
More information about the Python-list
mailing list