[Biopython-dev] ApplicationResult and generic_run obsolete?

Peter biopython at maubp.freeserve.co.uk
Thu Aug 6 16:05:24 UTC 2009


On Thu, Aug 6, 2009 at 4:48 PM, Peter wrote:
> The other approach which would allow our command line wrappers
> to be passed directly to subprocess is to make them more string
> like - but the subprocess code checks for string command lines
> using isinstance(args, types.StringTypes) which means we would
> have to subclass str (or unicode). I'm not sure if this can be made
> to work yet...

Thinking about it a bit more, str and unicode are immutable objects,
but we want the command line wrapper to be mutable (e.g. to add,
change or remove parameters and arguments). So it won't work.

Going back to my the original email, we could replace
Bio.Application.generic_run instead:
http://lists.open-bio.org/pipermail/biopython-dev/2009-July/006344.html
>
> Possible helper functions that come to mind are:
> (a) Returns the return code (integer) only. This would basically
> be a cross-platform version of os.system using the subprocess
> module internally.
> (b) Returns the return code (integer) plus the stdout and stderr
> (which would have to be StringIO handles, with the data in
> memory). This would be a direct replacement for the current
> Bio.Application.generic_run function.
> (c) Returns the stdout (and stderr) handles. This basically is
> recreating a deprecated Python popen*() function, which seems
> silly.

Or we just declare both Bio.Application.generic_run and
ApplicationResult obsolete, and simply recommend using subprocess with
str(cline) as before. Would someone like to proof read (and test) the
tutorial in CVS where I switched all the generic_run usage to
subprocess?

Peter



More information about the Biopython-dev mailing list