Are ActivePython scripts compatible with Linux?

A.M alanalan at newsgroup.nospam
Wed May 31 13:29:22 EDT 2006


Thanks alot Larry for your comprehensive answer.

"Larry Bates" <larry.bates at websafe.com> wrote in message 
news:SYCdnZBPbu0GTeDZnZ2dneKdnZydnZ2d at comcast.com...
> Short answer: yes
>
> Things to watch out for:
>
> 1) Versions on both Windows/Linux need to be compatible.  If Linux
> has same or later version, you are normally OK.  If Linux version
> is older, you will have to use only Python Libraries and functions
> that are in the oldest version.
>
> 2) Don't use OS-specific constructs.  Things like backslashes
> in filenames, etc.  Use os.path.join, os.path.basename, etc. to work
> with paths.  Linux has OS-specific code that handles all the
> cross-OS problems for you if you use these methods.  Don't hard
> code drive letters in your code, Linux/Mac don't have drive letters.
>
> 3) Obviously you can't use Python Windows extensions, which won't
> port.  You can't move something that is written as COM object or
> as a Windows service (sorry those were probably too obvious ;-).
>
> 4) If you use GUI, use something that is cross-platform (like
> wxWindows, TK, etc.).  You can't use Windows-specific GUI calls.
>
> 5) You can be affected by word length issues if you move from
> 32-bit Windows to 64-bit Linux.  Normally this is only only
> a problem if you use struct module to pack/unpack buffers or if
> you do bit shift operations (e.g. <<, >>).
>
> 6) Don't depend on Windows line endings in files.  Linux/Mac
> use different ones than Windows.
>
> 7) Some Linux machine have different endian storage of bytes.
> If you do bit shifting or struct pack/unpack you will need to
> take that into account.
>
> 8) If you have OS-specific "things" in your code, put them in
> a function or class that can easily be rewritten for the
> specific OS you are porting to.  Don't spread them out all
> through your code.  It is much easier to rewrite a couple of
> functions/classes that are OS-specific than it is to try to
> find problems all over your program.
>
> Hope info helps at least a little.
>
> -Larry
>
>
> A.M wrote:
>> Hi,
>>
>>
>>
>> I am planning to develop python applications on windows and run them on
>> Linux. Are ActivePython scripts compatible with Linux? Is there any
>> guideline that explains the compatibility issues between python in 
>> different
>> platforms?
>>
>>
>>
>> What would be the best approach for what I am trying to do?
>>
>>
>>
>> Any help would be appreciated,
>>
>> Alan
>>
>> 





More information about the Python-list mailing list