[Distutils] expected non-zero return values when spawning subprocesses

Stefan Seefeld seefeld at sympatico.ca
Sat Jan 21 02:41:12 CET 2006

Hi there,

I'm using distutils.spawn.spawn() to run subprocesses during my
build commands. It now happens that one of those subprocesses will
return a non-zero value that doesn't strictly correspond to an error,
and thus I'd like to catch it from within my python code.

It appears spawn() itself will raise a message containing a stringified
version of the exit code, but not the exit code itself. This seems to
imply that, in order to discriminate on the exit value, I have to
catch DistutilsExecError, and then parse the string. This seems rather
unelegant. Is there some better way ? Could the exception be modified
to contain the original code (as an integral value) ?


More information about the Distutils-SIG mailing list