![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Expert Programmer
|
Compiled Python code dependencies
I am considering writing an application in Python that would use wxPython for a GUI, Cheetah for making use of HTML templates, etc. My question is, once the program is written, will any computer I want to run it on need to have Python, wxPython, Cheetah, etc. installed? Or is there a way to compile it (using py2exe/py2app, for example) so that it can run on any computer?
|
|
|
|
|
|
#2 |
|
Programming Guru
![]() |
When you compile it using py2exe, it should automatically package everything that you need. There are only certain situations where you might need to specify something extra to bundle, like the windows XP style with wxpython (search the python forums).
The only time that you run in to an issue involving running a python script on a different computer, is if you're doing something os-dependant, like system('cls'), or using a windows newline '\n' as opposed to the standard linux CRLF '\r\n'. Or perhaps doing something like sniffing traffic, which is handled differently in Linux than Windows. Basically any problems with running it on a different computer has something to do with using non cross-platform compatible functions. The compiled exe with py2exe has the python interpretor and all the script's libraries included. Most, if not all, of your programs should be natively compatible. |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
Just to clarify, your program is not turned into native code. Its still python bytecode. From how I understand py2exe, py2app and freeze create an executable with python and all the needed libraries in embedded in it. This is why you might notice large executable size for you program.
|
|
|
|
|
|
#4 |
|
Expert Programmer
|
Thanks for the replies, Sane and Game Ender.
Sane, I think you mixed up '\n' and '\r\n' in your explanation. |
|
|
|
|
|
#5 |
|
Programming Guru
![]() |
Nah. When I switched a program over from Windows to Linux, Linux was not registering a plain '\n' as a new line when streaming to a binary file. I had to make it '\r\n' to work.
|
|
|
|
|
|
#6 | |
|
Expert Programmer
|
Check Wikipedia:
Quote:
|
|
|
|
|
|
|
#7 |
|
Programming Guru
![]() |
I don't care what Wikipedia says. I'm stating what I had to do. That's what I know, and I know that's what happened.
|
|
|
|
|
|
#8 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
Regardless to what your problem was, LF is the proper Unix/Linux line endings. You can look at the subversion manual which goes on in depth about there system to keep these straight. I have also opened windows files in emacs and seen all the ^M that the '\r' were turned into.
|
|
|
|
|
|
#9 | |
|
Newbie
Join Date: Jan 2006
Posts: 20
Rep Power: 0
![]() |
Quote:
|
|
|
|
|
|
|
#10 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
Why Python would be acting like that, I couldn't say. However, everyone else is correct in saying that the Linux newline delimiter is \n, whilst the Windows one is \r\n. Something else must have been going on if you needed to apply the Windows delimiter to Linux and vice versa. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|