how to excute a python-2.2 script in python-1.5.2?

Terry Reedy tjreedy at udel.edu
Sat Dec 21 12:35:58 EST 2002


"Ouyang" <zxo102 at hotmail.com> wrote in message
news:f10f7c39.0212210009.beeac67 at posting.google.com...
> Hi, everyone:
>    I have an python application which works in python-1.5.2 but not
in
> python-2.1/2.2.

There were only a few backwards incompatible changes in the newer
version of Python.  Most scripts should run without change.  If not,
it should be fairly easy to update.

> Now I want to write a script with some modules from
> python 2.1/2.2 and excute the script in this application running
under
> python-1.5.2. Any body knows how to do this?

If the script or the modules use any of the several new features
introduced in 2.0, 2.1, and 2.2, they will not run under an older
interpreter.  Update your 1.5 script instead.

> I did try the following, did not work right. Maybe I missed
something.
>
> For example, here is the application running under python-1.5.2
>
> #!c:\python1.5.2\python.exe
> #.....my application....
> #
> import os
> os.system("c:\test\mytest.py")
> print "ok ...."
>
> #...........

> Here is the test script  c:\test\mytest.py (called from the above
and
> should run in python2.2):
>
> #!c:\python22\python.exe
>
> print "Good. Finally I am here"
> print "finished"

This script would have run with Python 1.0!  What did not work?

Terry J. Reedy





More information about the Python-list mailing list