porting python script from linux to windows

Rene Pijlman reply.in.the.newsgroup at my.address.is.invalid
Fri Dec 12 15:39:47 EST 2003


hokieghal99:
>What are the specific steps that one should take to make a python script 
>that works on a Linux x86 machine also work on a Windows x86 machine?

Check for platform dependencies in the documentation of all modules that
you use.

>I am using os, re and string in the script. How do paths differ between 
>the two OSes? I am use to a unix-like path /blah/blah/blah. Would I need 
>to change this to x:\blah\blah\blah where x = drive letter?

I'm currently developing an app on Windows and testing it for production
on Linux. I use os.path.join() to construct pathnames and have encountered
no portability problems.

>What about creating fs objects? file works the same on both? 

Yes. But note the advice about binary files in the documentation of the
open()/file() builtin function.

>os.walk works the same?

It works :-)

-- 
René Pijlman




More information about the Python-list mailing list