[BioPython] BLAST subprocess problem with a GUI
Peter
biopython at maubp.freeserve.co.uk
Wed Jan 28 12:45:25 EST 2009
On Tue, Jan 13, 2009 at 10:41 AM, Peter <biopython at maubp.freeserve.co.uk> wrote:
> On Tue, Jan 13, 2009 at 7:38 AM, Stefanie Lück <lueck at ipk-gatersleben.de> wrote:
>> I was a little bit to optimistic...
>>
>> After compilation with py2exe, blast hangs. In the log file of py2exe
>> I get the following error message:
>>
>> Traceback (most recent call last):
>> File "prim_search.pyc", line 464, in make_xml
>>
>> File "Bio\Blast\NCBIStandalone.pyc", line 1668, in blastall
>> File "Bio\Blast\NCBIStandalone.pyc", line 1992, in _invoke_blast
>> File "subprocess.pyc", line 586, in __init__
>> File "subprocess.pyc", line 681, in _get_handles
>> File "subprocess.pyc", line 722, in _make_inheritable
>> TypeError: an integer is required
>>
>> Any ideas?
>> Stefanie
>
> Are you using Biopython 1.49?
>
> What version of Python are you using here? (Python 2.3 is handled a
> little differently, as it does not have the subprocess module).
>
> Can you confirm the exact same code works fine run from Python
> directly (via IDLE or the commandline?), but fails via py2exe?
>
> Are you running the py2exe compiled version from the Windows command
> line? Can you try that, even thought you said it was a GUI program.
> This might be related to the following python bug on Windows to do
> with pipe redirection, http://bugs.python.org/issue1124861
> If so, I think there is a suggested work around we can try (this will
> require a change to the Biopython code).
>
> Peter
Hi Stefanie,
Did you make any progress with this problem? If as I suspect the
problem is the python subprocess bug
http://bugs.python.org/issue1124861 then you can try the suggested
work around in Biopython, by modifying the _invoke_blast function in
Bio\Blast\NCBIStandalone.py file as follows:
import subprocess, sys
#We don't need to supply any piped input, but we setup the
#pipe anyway as a work around for a python bug if this is
#called from a Windows GUI program. For details, see:
#http://bugs.python.org/issue1124861
blast_process = subprocess.Popen(cmd_string,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=(sys.platform!="win32"))
blast_process.stdin.close()
return blast_process.stdout, blast_process.stderr
I've checked this change doesn't seem to break anything - but does it
help for your GUI program?
Peter
More information about the BioPython
mailing list