On Windows, urllib.url2pathname('///path/to/file') returns r'\\\path\to\file'. This path cannot be used in things like open() and os.access(). It should probably return r'\path\to\file'. In addition, '//localhost/path/to/file' is a special case that should become '\path\to\file'. I'll post this as a separate bug since it affects all file URIs.
Logged In: YES user_id=371366 See #649974 -- url2pathname() and pathname2url() are undocumented, platform-specific, and not really general-purpose. It probably should not be assumed that they are intended to produce values that are usable with open(), os.access(), or anything other than where they are currently used internally in urllib. The solution as proposed for #649974 is probably just to document the functions and discourage their general use. See the suggested diffs attached to that report.
Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as "Won't fix". Thank you! . Facundo
Logged In: YES user_id=752496 The documentation for urllib states that: Although the urllib module contains (undocumented) routines to parse and unparse URL strings, the recommended interface for URL manipulation is in module urlparse. So, if you think that the files should also be modified, change the group of this bug to 2.4. Otherwise it will be closed as won't fix.
Logged In: YES user_id=371366 Ah, gotcha. I am closing this as "Wont Fix", myself. I have modified the description of #649974 to make it be a Documentation enhancement for 2.4. My proposed patches in that report will satisfy my concerns without going into unnecessary detail. Thanks! -Mike