[Tutor] Tutorial executable from python script.
Karim Liateni
karim.liateni at free.fr
Sun Mar 21 10:51:31 CET 2010
Hello Lie,
Thanks for your advices.
To have correct updates from ITs is really a true pain. The network
is worldwide in our company. I found issues having decent version.
On my local workstation I have Python v1.5, on compute farm LSF
machines sometimes 2.2 , 2.3, 2.6. That's why I don't want to rely
on machine installation and provide a unique version with my
application installation. I know we did the same for TCL to be sure
to have 8.4 version. I just wanted to know if there is some tutos about
this topic.
Regards
Karim
Lie Ryan wrote:
> 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 at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
More information about the Tutor
mailing list