On 03/21/2010 06:00 AM, Karim Liateni wrote: > > Hello Alan, > > In fact, I want to be sure the users can run it on every machine in our > network. > Especially, I want to be able to run it on Solaris 5.8 with python 1.5 > (Unix machine). > I wanted to know if I could make some custom executable like in C when > you want > to build a executable with a static library to be sure if the system > does not have > the correct shares libraries.
If you know that the machine contains `python` (whatever the version is) you can use sys.version to check the system python's version. It can be as simple as: import sys if int(sys.version[0]) > 1 or (int(sys.version[0]) == 1 and int(sys.version[2] >= 5)): # or you can start a subprocess instead, # abusing import makes "if __name__ == '__main__':" magic not work import MyMainProgram else: # parentheses guards for python 3 print ('script is only compatible with python version 1.5 and above') Otherwise, if you cannot even rely on python being available, you may need to use shell script. > Perhaps the better is to build a python version embedded in my > application installation. > Do you have any examples or tutorial on how integrate python inside a > pplication to be > sure that we have all in one and not depand on any local machine > installation environment. > I need as to embed gtk python library for graphical use. That is indeed possible, however is there any reason why the server don't upgrade its python version? CPython makes it easy to do parallel installation of two different python version. If you can persuade the machine administrator to install python2.6 as an altinstall; you can simply change the hashbang line of your script to "#!/usr/bin/env python2.6" and all is well. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor