[Biopython-dev] Problems with Bio.Application.generic_run()

Steffi Gebauer-Jung gebauer-jung at ice.mpg.de
Thu Jun 19 09:38:09 EDT 2003


using the Bio.Application package, I got some trouble.

When using generic_run() to run blast, which in this case produced a 
*very* large output and several warnings, the blast process fell asleep. 
Running this blast as standalone, there were no problems.

Looking around in the Python Reference etc. I found that there is 
possibly a dead lock of the parent and child processes.

For now I solved this problem using a recipe from the Python Cookbook as 

def generic_run(commandline):
    """Run an application with the given commandline.

    This expects a pre-built commandline that derives from
    AbstractCommandline, and returns a ApplicationResult object
    to get results from a program, along with handles of the
    standard output and standard error.

    This is a deadlock save version.
    It was derived from 
    Comment: Differnet Approach: Using Tempfiles, Tobias Polzin, 2002/09/03
    outfile = tempfile.mktemp()
    errfile = tempfile.mktemp()
    errorlevel = os.system("( %s ) > %s 2> %s" % 
(str(commandline),outfile,errfile)) >> 8

    r_out = open(outfile,"r").read()

    e_out = open(errfile,"r").read()

    return ApplicationResult(commandline), \
           File.UndoHandle(StringIO.StringIO(r_out)), \

Please could you have a look at this quite central method or tell me a 
more save one to use instead?

Thanks in advance,
Steffi Gebauer-Jung

More information about the Biopython-dev mailing list