[Biopython-dev] subprocess and calling application wrappers
Peter
biopython at maubp.freeserve.co.uk
Tue Jun 1 15:15:03 UTC 2010
On Tue, Jun 1, 2010 at 2:23 PM, Brad Chapman <chapmanb at 50mail.com> wrote:
> Peter;
>
>> 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.
> [...]
>> We could instead make the wrapper objects callable (define
>> the magic method __call__) to offer this kind of functionality.
>> This seems quite elegant to me.
>
> This is a good idea, although I'm 50/50 on the __call__ idea.
> Having a run() command or something similar might be more intuitive
> then the more magical call, if the idea is to appeal to users who
> find subprocess too problematic.
Fair point. We'd have to audit all the existing wrappers to make
sure we have some suitable names free (e.g run or execute).
> I'd suggest having an option to not capture stdout and stderr, which
> would help users avoid those cases where a program spews a lot to
> stdout and it's unwieldy to capture and stick it into a string.
We need to avoid any risk of deadlocks, so I guess the safe
implementation here would be call subprocess with stdout and
stderr sent to dev null.
Peter
More information about the Biopython-dev
mailing list