porting python script from linux to windows
danb_83 at yahoo.com
Sat Dec 13 01:24:30 CET 2003
hokieghal99 <hokiegal99 at hotmail.com> wrote in message news:<brd5n1$jj1$1 at solaris.cc.vt.edu>...
> 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?
> 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?
You woudn't *need* to; the drive letter can be omitted when the file
is on the same drive. Also, Windows doesn't care what kind of slashes
you use (except for cmd.exe).
But you will have to, for example, change "/home/dan" to
"c:\\winnt\\Documents and Settings\\dan".
> What about
> creating fs objects? file works the same on both?
For the most part, yes, but in mind that, on Windows, it matters
whether you open a file in text or binary mode.
> os.walk works the same?
More information about the Python-list