By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,332 Members | 1,117 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,332 IT Pros & Developers. It's quick & easy.

Using two pythons in an application

P: n/a
I'm in the process of developing an application that will use Python for
a scripting support. In light of the upcoming changes to Python, I was
wondering if it is possible to link to and use two different versions of
Python so that in the future, scripts could be migrated to the new
version, and older scripts would still work as well. If so are there
any code examples of this.

Brian Vanderburg II
Aug 3 '08 #1
Share this Question
Share on Google+
6 Replies

P: n/a
On Sun, 03 Aug 2008 14:01:49 -0400, Allen <br***************@yahoo.comwrote:
I'm in the process of developing an application that will use Python for
a scripting support. In light of the upcoming changes to Python, I was
wondering if it is possible to link to and use two different versions of
Python so that in the future, scripts could be migrated to the new
version, and older scripts would still work as well. If so are there
any code examples of this.
I cannot answer that, sorry.

But if I were you, I'd pick a current, stable Python version for my
application, and stop worrying for now.

If there is a new, incompatible Python version (I assume you're
talking about Py3k?) these things will happen:

- people around the world will decide to migrate
- people will gain experience with migrating Python code
- Python 2.x will start to look obsolete
- things like Linux distributions and web hosting companies will
stop offering Python 2.x
- you will be forced (for practical reasons, or to avoid looking silly)
to migrate your application (and break old scripts)

All this will happen *slowly* -- I believe so slowly that you will
have plenty of time to act later. And your users (or whoever has to
deal with the scripts) will not be alone; lots of people will sit
around migrating old Python code.

(Caveat: I don't know much about the Py3k transition, just about other
cases like that. Killing off an old language dialect takes time!)

/Jorgen

--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.se R'lyeh wgah'nagl fhtagn!
Aug 3 '08 #2

P: n/a
Allen wrote:
I'm in the process of developing an application that will use Python for
a scripting support. In light of the upcoming changes to Python, I was
wondering if it is possible to link to and use two different versions of
Python so that in the future, scripts could be migrated to the new
version, and older scripts would still work as well. If so are there
any code examples of this.

Brian Vanderburg II
Unlike languages you pay for, Python has on real motivation to "obsolete" old
versions of Python (e.g. to force you to pay of an upgrade). You can still get
version 1.5.2 of Python and it is MANY years old and most could consider quite
obsolete. I just would not worry about it and stick with 2.5/2.6 for
development and begin looking at Python 3.0 so I can learn what's new and exciting.

-Larry
Aug 3 '08 #3

P: n/a
Larry Bates wrote:
Allen wrote:
>I'm in the process of developing an application that will use Python
for a scripting support. In light of the upcoming changes to Python,
I was wondering if it is possible to link to and use two different
versions of Python so that in the future, scripts could be migrated
to the new version, and older scripts would still work as well. If so
are there any code examples of this.

Brian Vanderburg II

Unlike languages you pay for, Python has on real motivation to
"obsolete" old versions of Python (e.g. to force you to pay of an
upgrade). You can still get version 1.5.2 of Python and it is MANY
years old and most could consider quite obsolete. I just would not
worry about it and stick with 2.5/2.6 for development and begin looking
at Python 3.0 so I can learn what's new and exciting.

-Larry
I agree. I had wanted for scripts of the program to be able to use the
new string format method that is only in py3k, but I'm currently looking
into other template solutions.

Brian Vanderburg II
Aug 3 '08 #4

P: n/a
Allen wrote:
Larry Bates wrote:
>Allen wrote:
>>I'm in the process of developing an application that will use Python
for a scripting support. In light of the upcoming changes to Python,
I was wondering if it is possible to link to and use two different
versions of Python so that in the future, scripts could be migrated
to the new version, and older scripts would still work as well. If
so are there any code examples of this.

Brian Vanderburg II

Unlike languages you pay for, Python has on real motivation to
"obsolete" old versions of Python (e.g. to force you to pay of an
upgrade). You can still get version 1.5.2 of Python and it is MANY
years old and most could consider quite obsolete. I just would not
worry about it and stick with 2.5/2.6 for development and begin
looking at Python 3.0 so I can learn what's new and exciting.

-Larry

I agree. I had wanted for scripts of the program to be able to use the
new string format method that is only in py3k, but I'm currently looking
into other template solutions.

Brian Vanderburg II
There are many good ones around that you can look at:

http://www.webwareforpython.org/Papers/Templates/

-Larry
Aug 4 '08 #5

P: n/a
On Aug 3, 5:43*pm, Allen <brian_vanderbu...@yahoo.comwrote:
Larry Bates wrote:
Allen wrote:
I'm in the process of developing an application that will use Python
for a scripting support. *In light of the upcoming changes to Python,
I was wondering if it is possible to link to and use two different
versions of *Python so that in the future, scripts could be migrated
to the new version, and older scripts would still work as well. *If so
are there any code examples of this.
Brian Vanderburg II
Unlike languages you pay for, Python has on real motivation to
"obsolete" old versions of Python (e.g. to force you to pay of an
upgrade). *You can still get version 1.5.2 of Python and it is MANY
years old and most could consider quite obsolete. *I just would not
worry about it and stick with 2.5/2.6 for development and begin looking
at Python 3.0 so I can learn what's new and exciting.
-Larry

I agree. *I had wanted for scripts of the program to be able to use the
new string format method that is only in py3k, but I'm currently looking
into other template solutions.
That should work in 2.6 (sans bugs).

To answer your original question, no, you can't load more than one
version of python within a single process. The best you can do is
running in a child process.
Aug 4 '08 #6

P: n/a
On Sun, 03 Aug 2008 17:36:40 -0500, Larry Bates <la*********@websafe.com`wrote:
Allen wrote:
>I'm in the process of developing an application that will use Python for
a scripting support. In light of the upcoming changes to Python, I was
wondering if it is possible to link to and use two different versions of
Python so that in the future, scripts could be migrated to the new
version, and older scripts would still work as well. If so are there
any code examples of this.

Brian Vanderburg II

Unlike languages you pay for, Python has on real motivation to "obsolete" old
versions of Python (e.g. to force you to pay of an upgrade). You can still get
version 1.5.2 of Python and it is MANY years old and most could consider quite
obsolete.
Except at some point

- security bug fixes will stop coming for very old Python releases
- people will become used to the new, improved syntax and hate to use
old versions
- new versions of third-party modules will not be compatible with old
releases

So there *is* pressure to upgrade, sooner or later. But the time scale
is several years, not months.
I just would not worry about it and stick with 2.5/2.6 for
development and begin looking at Python 3.0 so I can learn what's new and exciting.
Yeah.

/Jorgen

--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.se R'lyeh wgah'nagl fhtagn!
Aug 5 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.