[python-win32] ActiveState Python + Cygwin Query

Trent Mick trentm at activestate.com
Tue Jan 8 23:16:10 CET 2008


Tennis Smith wrote:
> Now, how do you get ActiveState Python to work with the cygwin paths?
> 

What Andrew said:
 > What exactly is the problem that you’re seeing?  Cygwin accepts
 > c:/some/where/file.xt, c:\\some\\where\\file.txt,
 > ‘c:\some\where\file.txt’, /cygdrive/c/some/where/file.txt, and so on.

And also, I found this snippet in some of my code (*):

def _cygpathFromWinPath(path):
     assert sys.platform == "win32"
     if not os.path.isabs(path):
         path = os.path.abspath(path)
     drive, tail = os.path.splitdrive(path)
     path = "/cygdrive/%s%s"\
            % (drive.strip(':').lower(), tail.replace(os.sep, '/'))
     return path

Perhaps that will help.

Cheers,
Trent

(*) This is from code for working with the Mozilla build system, which 
used to build with cygwin.


-- 
Trent Mick
trentm at activestate.com


More information about the python-win32 mailing list