[Biopython-dev] subprocess and calling application wrappers

Peter biopython at maubp.freeserve.co.uk
Tue Jun 1 13:10:05 UTC 2010


On Mon, May 31, 2010 at 3:50 PM, Peter wrote:
> Hi all,
>
> With the new command line wrappers and the tutorial pushing
> users towards using subprocess we've had more queries
> about how to use it. The subprocess module itself is rather
> scary I guess, and things could be made a lot easier.
>
> I think the most typical use cases are:
>
> (1) Run the command, return the error code (integer)
> (2) Run the command, return stdout, stderr and error code
>
> In theory the function subprocess.call() would take care
> of the first example, but there is a cross platform annoyance
> here with the shell parameter. Also, if you want the output
> too things get even more tricky. It hasn't helped that there
> are a few platform specific quirks/bugs in subprocess itself
> (the different behaviour of the shell option on Windows,
> bug http://bugs.python.org/issue1124861 in old Pythons,
> the risk of deadlocks with large output files, etc).

In fact I've often found using os.system() much easier than
subprocess for the first use case - running a command and
getting the return code. I wondered about adding an example
of this to the tutorial but didn't find time before the last release
(even if the Python documentation does try and encourage
using subprocess instead).

Peter



More information about the Biopython-dev mailing list