473,700 Members | 2,839 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 1748
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
4614
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. I found the same features of both solutions, so I can see no reason to back to ActivePython. --...
1
5188
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 technically not supposed to install to a directory with a space in the name, but it worked fine for...
4
2146
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 nagging problem with Python? Please feel free to chide me if this is a no-brainer question.
1
2723
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 this. More on the error below, but has anyone else had this problem? Will there soon be a newer...
1
1625
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
18870
by: Ramdas | last post by:
How do I add users using Python scripts on a Linux machine? Someone has a script?
5
2198
by: Frank Swarbrick | last post by:
Why might one choose to use ActivePython instead of using the free CPython?
3
4104
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 step it says to apply a patch. But I could not get which file I've to modigy and where. I firmly...
14
3804
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
8638
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8952
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8909
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5894
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4395
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3081
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
3
2018
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.