473,378 Members | 1,346 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Are ActivePython scripts compatible with Linux?

A.M
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
May 31 '06 #1
3 1722
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

May 31 '06 #2
A.M
Thanks alot Larry for your comprehensive answer.

"Larry Bates" <la*********@websafe.com> wrote in message
news:SY******************************@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

May 31 '06 #3
A.M wrote:
I am planning to develop python applications on windows and run them on
Linux. "Larry Bates" <la*********@websafe.com> wrote in message
news:SY******************************@comcast.com. ..
Short answer: yes

A.M wrote: Thanks alot Larry for your comprehensive answer.


Small addition: test, test, test. This is the only way to make sure
your program works on another platform. VMware is offering now free
virtual machine emulator, vmplayer. You have no excuse not to install
linux! :) If you have dual-core processor or an idle machine you can
even setup http://buildbot.sf.net to continuously test your source code
changes.

May 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: JZ | last post by:
Who can explain me what is the advantage of ActivePython over (1) standard Python 2.3.2 instalation (from www.python.org) plus (2) the latest win32? (I am using win32 box, of course). In past I...
1
by: Justin Stockton | last post by:
I recently upgraded from ActivePython 2.2.2 to ActivePython 2.3.2 and I'm running into an issue importing the win32com.client module. Before installing the new version, I made sure to properly...
4
by: Hoang | last post by:
Is it possible to install multiple versions of ActivePython on the same machine? Many modules which used to work with Python 2.2 now don't on 2.3. I am using some 2.3 features but lots of...
1
by: Steve M | last post by:
When I use the COM Makepy utility on one computer with WindowsXP, ActivePython 2.3 and I select the library Microsoft Word 10.0 Object Library (8.2), things work fine. When I have WindowsXP,...
1
by: Fuzzyman | last post by:
Hello all, In the past I've used the ActivePython distribution for windows. Particularly their chm help manual is excellent. I have heard that the ActivePython distribution *doesn't* include...
20
by: Ramdas | last post by:
How do I add users using Python scripts on a Linux machine? Someone has a script?
5
by: Frank Swarbrick | last post by:
Why might one choose to use ActivePython instead of using the free CPython?
3
by: kodaliece | last post by:
Hello Everyone, I am trying to configure Tomcat5.5 to run PHP5.2.5 scripts on linux machine. I got some information from http://wiki.apache.org/tomcat/UsingPhp as how to do this. First, It says...
14
by: Trent Mick | last post by:
I'm happy to announce that ActivePython 2.6.0.0 is now available for download from: http://www.activestate.com/Products/activepython/ ActivePython 2.6.0.0 is based on Python 2.6.0. What is...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.