Strange "feature" involving double slashes in Win98

Peter Hansen peter at engcorp.com
Tue Sep 14 18:16:59 EDT 2004


Carlos Ribeiro wrote:

> On Tue, 14 Sep 2004 16:43:46 -0400, Peter Hansen <peter at engcorp.com> wrote:
>> >>> os.path.abspath('c://somepath')
>>'c:\\somepath'
 >
> Strange. I've tried it here with different results.
> 
> ActivePython 2.3.2 Build 232 (ActiveState Corp.) based on
> Python 2.3.2 (#49, Nov 13 2003, 10:34:54) [MSC v.1200 32 bit (Intel)] on win32
> 
>>>>import os.path
>>>>os.path.abspath('c://work')
> 
> 'c:\\\\work'
> 
> Of course, I'm not using the same build as you. Either there was some
> bugfix inbetween 2.3.2 and 2.3.4, or the underlying libraries used by
> ActivePython and standard Python differ in this regard (not highly
> probable, anyway). I'm not sure.

Do you have pywin32 (win32all) installed?  Try this one instead:

   win32api.GetFullPathName('c://work')

This does the same as abspath does above, on mine.  I ask because
of stuff in ntpath.py which appears to be calling the equivalent
of that instead of the normpath(join(getcwd(), path)) approach that
the docs note is equivalent...

-the-blind-leading-the-blind-ly y'rs,
  Peter



More information about the Python-list mailing list