469,635 Members | 1,852 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,635 developers. It's quick & easy.

Wanted: a python24 package for Python 2.3

Hello

My problem is that I want a Python 2.4 module on
a server that is running Python 2.3. I definitely
want to use the 2.4 module, and I don't want to
require the server to move to Python 2.4.

More exactly, I am using subprocess, which is
new in Python 2.4. What I am writing is something
like
===
from subprocess import Popen
===

This will fail in Python 2.3, in which case I
would like to write something like
===
try:
from subprocess import Popen
else ImportError:
from somewhere_else import Popen
===

Put this way, it is clear (to me) that somewhere_else
should be python24.

In other words, I'm asking for a python24 package that
contains all (or most) of the modules that are new to
Python 2.4.

I've looked around a bit, and it seems that this
formulation of the solution is new. I wonder if
anyone else has encountered this problem, or has
comments on my solution.

--
Jonathan

Mar 20 '07 #1
7 1617
On Mar 20, 10:33 am, Jonathan Fine <j...@pytex.orgwrote:
Hello

My problem is that I want a Python 2.4 module on
a server that is running Python 2.3. I definitely
want to use the 2.4 module, and I don't want to
require the server to move to Python 2.4.

More exactly, I am using subprocess, which is
new in Python 2.4. What I am writing is something
like
===
from subprocess import Popen
===

This will fail in Python 2.3, in which case I
would like to write something like
===
try:
from subprocess import Popen
else ImportError:
from somewhere_else import Popen
===

Put this way, it is clear (to me) that somewhere_else
should be python24.

In other words, I'm asking for a python24 package that
contains all (or most) of the modules that are new to
Python 2.4.

I've looked around a bit, and it seems that this
formulation of the solution is new. I wonder if
anyone else has encountered this problem, or has
comments on my solution.

--
Jonathan
You might be able to use the "from future import SomeModule" syntax to
accomplish this, but I am not sure. Other than that, I would just
recommend using the os.popen calls that are native to 2.3

Mike

Mar 20 '07 #2
Jonathan Fine <jf***@pytex.orgwrote:
...
In other words, I'm asking for a python24 package that
contains all (or most) of the modules that are new to
Python 2.4.
For subprocess specifically, see
<http://www.lysator.liu.se/~astrand/popen5/. I don't think anybody's
ever packaged up ALL the new stuff as you require.
Alex
Mar 20 '07 #3
ky******@gmail.com wrote:
On Mar 20, 10:33 am, Jonathan Fine <j...@pytex.orgwrote:
>>My problem is that I want a Python 2.4 module on
a server that is running Python 2.3. I definitely
want to use the 2.4 module, and I don't want to
require the server to move to Python 2.4.
You might be able to use the "from future import SomeModule" syntax to
accomplish this, but I am not sure. Other than that, I would just
recommend using the os.popen calls that are native to 2.3
I've already made my mind up. I want to use subprocess on
both 2.3 and 2.4. To do this, 2.3 sites have to have a copy
of the subprocess module.

My question (snipped) is how best to package this up.

best regards
Jonathan

Mar 20 '07 #4
Hi,
You can't import subproces from future, only syntactic and semantic
changes that will become standard feature in future python version can
be activated that way.

You can copy the subprocess module from python 2.4 somewhere where it
will be found from python 2.3. At least subporcess is importable after that:

--- snip ---
klix@vesuv6:~/tttcp -av /usr/local/lib/python2.4/subprocess.py .
/usr/local/lib/python2.4/subprocess.py -./subprocess.py
klix@vesuv6:~/tttpython2.3
Python 2.3.3 (#1, Jun 29 2004, 14:43:40)
[GCC 3.3 20030226 (prerelease) (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import subprocess
--- snip ---

HTH,
Gerald

ky******@gmail.com schrieb:
On Mar 20, 10:33 am, Jonathan Fine <j...@pytex.orgwrote:
>>Hello

My problem is that I want a Python 2.4 module on
a server that is running Python 2.3. I definitely
want to use the 2.4 module, and I don't want to
require the server to move to Python 2.4.

More exactly, I am using subprocess, which is
new in Python 2.4. What I am writing is something
like
===
from subprocess import Popen
===

This will fail in Python 2.3, in which case I
would like to write something like
===
try:
from subprocess import Popen
else ImportError:
from somewhere_else import Popen
===

Put this way, it is clear (to me) that somewhere_else
should be python24.

In other words, I'm asking for a python24 package that
contains all (or most) of the modules that are new to
Python 2.4.

I've looked around a bit, and it seems that this
formulation of the solution is new. I wonder if
anyone else has encountered this problem, or has
comments on my solution.

--
Jonathan


You might be able to use the "from future import SomeModule" syntax to
accomplish this, but I am not sure. Other than that, I would just
recommend using the os.popen calls that are native to 2.3

Mike
Mar 20 '07 #5
Alex Martelli wrote:
Jonathan Fine <jf***@pytex.orgwrote:
...
>>In other words, I'm asking for a python24 package that
contains all (or most) of the modules that are new to
Python 2.4.


For subprocess specifically, see
<http://www.lysator.liu.se/~astrand/popen5/.
Thanks for the URL.
I don't think anybody's
ever packaged up ALL the new stuff as you require.
Actually, all I require (for now) is subprocess. So
I went and made a python24 module. I'll change this
if people think something else would be better. (It's
easy to ask for forgiveness than ask for permission.)

I can show you what I've done:
http://texd.cvs.sourceforge.net/texd/py/python24/
http://texd.cvs.sourceforge.net/texd....4&view=markup

My idea is that python24 should contain the Python 2.4
modules that those who are still on Python 2.3 might
want to use.

Similarly, python26 would be modules that are new
for Python 2.6 (which has not been released next).

I doubt that I'm the only one with this problem, and
this is my suggestion for making it easier to solve.

--
Jonathan
Mar 20 '07 #6
In article <1h**************************@mac.com>,
Alex Martelli <al***@mac.comwrote:
>
For subprocess specifically, see
<http://www.lysator.liu.se/~astrand/popen5/. I don't think anybody's
ever packaged up ALL the new stuff as you require.
Oh, good that web page came back. (When we were down to the wire on
_Python for Dummies_, it had been offline for more than a month, and I
had to decide whether to include it, and I did.)
--
Aahz (aa**@pythoncraft.com) <* http://www.pythoncraft.com/

"Typing is cheap. Thinking is expensive." --Roy Smith
Mar 20 '07 #7
Gerald Klix wrote:
Hi,
You can't import subproces from future, only syntactic and semantic
changes that will become standard feature in future python version can
be activated that way.

You can copy the subprocess module from python 2.4 somewhere where it
will be found from python 2.3. At least subporcess is importable after
that:

--- snip ---
klix@vesuv6:~/tttcp -av /usr/local/lib/python2.4/subprocess.py .
/usr/local/lib/python2.4/subprocess.py -./subprocess.py
klix@vesuv6:~/tttpython2.3
Python 2.3.3 (#1, Jun 29 2004, 14:43:40)
[GCC 3.3 20030226 (prerelease) (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import subprocess
>>>
You're quite right about the use of __future__. I decided to
put subprocess in a package, so that my system can choose
which one to find, whether running Python 2.3 or 2.4.

(Well, in 2.3 there's no choice, but in 2.4 I don't want
the "just for 2.3" module to hide the real 2.4 module.)

The responses I've had indicate that my approach might
be a good idea, and might be useful to others. For me,
that's enough for now.

--
Jonathan

Mar 21 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by A. B., Khalid | last post: by
1 post views Thread by Warren Postma | last post: by
24 posts views Thread by Robin Becker | last post: by
10 posts views Thread by Bugs | last post: by
reply views Thread by Steven Samuel Cole | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.