A tale of two execs

bieffe62 at gmail.com bieffe62 at gmail.com
Mon Feb 23 12:28:44 EST 2009


On Feb 23, 6:06 pm, bieff... at gmail.com wrote:
> On Feb 23, 5:53 pm, aha <aquil.abdul... at gmail.com> wrote:
>
>
>
>
>
> > Hello All,
> >   I am working on a project where I need to support versions of Python
> > as old as 2.3. Previously, we distributed Python with our product, but
> > this seemed a bit silly so we are no longer doing this.  The problem
> > that I am faced with is that we have Python scripts that use the
> > subprocess module, and subprocess is not available in Python 2.3.
> > Below is the strategy I am thinking about using, however if, you have
> > better ideas please let me know.
>
> > def runner(cmd, stdin, stdout, ...):
> >   try:
> >     import subprocess
> >     sbm = 1
> >   except:
> >     sbm = 0
>
> >   # Now do something
> >   if sbm:
> >     process = subporcess(...)
> >   else:
> >     import popen2
> >     process = popen2.Popen4(...)
>
> > Has anyone else run into a situation similar to this one?
>
> IIRC,  subprocess is a pure python module. If so, tou could try if
> subprocess compiles under 2.3.

...

I checked, and, for windows platform subprocess.py uses the modules
mvscrt and _subprocess, which I ham unable to
locate on my windows XP python 2.6 installation. This make the whole
thing harder, even impossible if _subprocess has
been created especially for subprocess.py.

For non-windows platform, subprocess.py seem to use only fairly well-
established module, so there is a chance to backport it.

Ciao again
----------
FB



More information about the Python-list mailing list