osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

error in os.chdir


On Sat, 30 Jun 2018 23:36:40 +0000, eryk sun wrote:

> Only use forward slashes for legacy DOS paths passed to Windows API
> functions. Do not use forward slashes for paths in command line
> arguments, \\?\ prefixed paths, or registry paths.

I don't see why this is relevant, or at least not the "command line 
arguments" and "registry paths" parts.

We're talking about using file names in Python, not the Windows command 
line (Power Shell?), and not registry paths.

I guess that if the user is using a path beginning with \\?\ they may or 
may not need to use backslashes, but I have no way of testing it, and I 
would expect that Python will correctly replace //?/ with backslashes the 
same as it does for any other file system path.

I know that Chris said "for all paths" but in context that's to be 
understood as *file system paths*. We wouldn't interpret him as meaning 
this:

    import package/subpackage/module

instead of using dots, so I think registry paths is irrelevant.

(Besides, Python doesn't have an API for interacting directly with the 
registry.)




-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson