debugging os.spawn*() calls

Nick Craig-Wood nick at craig-wood.com
Fri Jan 28 13:30:00 EST 2005


Martin Franklin <mfranklin1 at gatwick.westerngeco.slb.com> wrote:
>  Skip Montanaro wrote:
> > I have an os.spawnv call that's failing:
> > 
> >     pid = os.spawnv(os.P_NOWAIT, "ssh",
> >                     ["ssh", remote,
> >                      "PATH=%(path)s nice -20 make -C %(pwd)s" % locals()])
> > 
> > When I wait for it the status returned is 32512, indicating an exit status
> > of 127.  Unfortunately, I see no way to collect stdout or stderr from the
> > spawned process, so I can't tell what's going wrong.
> 
>  While not a 'real' answer - I use pexpect to automate my ssh scripts 
>  these days as I had a few problems using ssh with the os.* family 
>  perhaps you may find pexpect a wee bit easier...

If using 2.4 the subprocess module is a good solution too.  It lets
you catch stdout/stderr easily.

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list