Is this a bug?

Tim Peters tim.one at home.com
Sun May 13 01:46:40 EDT 2001


[/F, qutoes the FAQ]
>>     If you're trying to build Windows pathnames, note that all
>>     Windows system calls accept forward slashes too:
>>
>>         f = open("/mydir/file.txt") # works fine!

[Alex Martelli]
> Hmmm, I wonder if this needs updating -- it's true for what
> Python exposes in builtins, module os, etc, but not for what
> comes in via win32all, I believe... the /-acceptance is in the
> C runtime libraries (generally) and not in the "system calls"
> themselves (Windows APIs).

Well, if you've got a spare year or two to try to reverse-engineer the Full
Truth across all flavors of Windows, happy to give you the FAQ password
<wink>.

I bumped into one Windows API function over the last year that required
backslashes, but can't remember which one.  If you search the Knowledge Base,
most hits on "forward slash" lead to acknowledged Windows bugs.

Platform SDK -> Windows Base Services -> Files and I/O -> File I/O ->
About Files -> Filename Conventions says (in part):

+ Use the backslash (\), the forward slash (/), or both to separate
  components in a path. No other character is acceptable as a path
  separator.

Almost always works for me.

and-the-places-it-doesn't-makes-windows-the-delightful-adventure-
    it-is-ly y'rs  - tim





More information about the Python-list mailing list