Re: The format of filename
- From: Tim Chase <python.list@xxxxxxxxxxxxxxxxx>
- Date: Thu, 26 Oct 2006 08:04:45 -0500
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
.
- References:
- The format of filename
- From: Neil Cerutti
- Re: The format of filename
- From: Fredrik Lundh
- Re: The format of filename
- From: Neil Cerutti
- Re: The format of filename
- From: Neil Cerutti
- Re: The format of filename
- From: Neil Cerutti
- Re: The format of filename
- From: Tim Roberts
- The format of filename
- Prev by Date: Re: chained attrgetter
- Next by Date: Re: Handling emails
- Previous by thread: Re: The format of filename
- Next by thread: Re: [OT] Win32 and forward/backslashes (was "The format of filename")
- Index(es):
Relevant Pages
|