473,563 Members | 2,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1735
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.basenam e, 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*********@we bsafe.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.basenam e, 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*********@we bsafe.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
4605
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 was using Active Python. I dropped it because of I needed tha last Python version and ActivePython was for a long time compiled for Python 2.2 only....
1
5170
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 remove old version (as well as the mx libraries I had installed). I then installed the new version as a user with the Administrator role. I know I'm...
4
2140
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 programs that used to work, don't anymore. This is especially true with modules that expose their libraries as DLLs. Has backward compatibility been a...
1
2717
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, ActivePython 2.4 (build 247) and Microsoft Word 11.0 Object Library (8.3), then I get the following SyntaxError, and on two different computers I tested...
1
1622
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 SSL support compiled in for windows. Can anyone confirm or deny this rumour for me ?
20
18853
by: Ramdas | last post by:
How do I add users using Python scripts on a Linux machine? Someone has a script?
5
2194
by: Frank Swarbrick | last post by:
Why might one choose to use ActivePython instead of using the free CPython?
3
4099
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 to apply patch to configuration file and then apply a patch to sapi/servlet/servlet.java. But I am stuck at the first step it self. In the first...
14
3797
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 ActivePython? ---------------------
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7945
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.