CSV module, DictReader problem (bug?)
fredrik at pythonware.com
Thu Nov 2 07:34:06 CET 2006
John Machin wrote:
> Not all APIs do the right thing. If you fire up the cmd.exe shell and
> feed it slashes as path separators, it barfs. Example:
> C:\junk>dir c:/junk/*.bar
> Invalid switch - "junk".
> Hence the advice to use rawstrings with backslashes -- they work under
> all circumstances.
we went through this a couple of days ago; all Windows API:s are
*documented* to accept backward or forward slashes, the command shell is
*documented* to only accept backward slashes.
if you're wrapping some cmd.exe command in an internal API, it's usually
easier to call "os.path.normpath" the last thing you do before you call
"os.system", than to get all the backslashes right in your code.
More information about the Python-list