[Biopython-dev] [Bug 2480] Local BLAST fails: Spaces in Windows file-path values
bugzilla-daemon at portal.open-bio.org
bugzilla-daemon at portal.open-bio.org
Tue Sep 30 22:19:22 UTC 2008
http://bugzilla.open-bio.org/show_bug.cgi?id=2480
------- Comment #27 from drpatnaik at yahoo.com 2008-09-30 18:19 EST -------
As I mentioned earlier, I am new to Python, and my usage of the subprocess is
indeed imperfect.
I tried the subprocess routine through a test.py file on a Mac OS X 10.5.5 with
Python 2.5.2, but w/o using Biopython. I had to use 'shell=True', otherwise
with 'shell=False',I get:
File "/Lab/Laboratory/Libs/Python/lib/python2.5/subprocess.py", line 594, in
__init__
errread, errwrite)
File "/Lab/Laboratory/Libs/Python/lib/python2.5/subprocess.py", line 1091, in
_execute_child
raise child_exception
With 'shell=True', it works even when there is a space in the file-path/names
of the BLAST executable, the database or the input sequence file (the escaping
of the spaces needs to be properly done).
--- test.py ---
# Note escaping of the space characters vary for
my_blast_cmd = r'"/Lab/Laboratory/Libs/NCBI_blast/bin/Change loc/blastall" -p
blastn -d "\"/Lab/Laboratory/Libs/NCBI_blast/data/Change loc/My db\"" -i
/Lab/Laboratory/Libs/NCBI_blast/data/My\ seq.txt -m 7'
import subprocess
my_process = subprocess.Popen(my_blast_cmd, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
my_blast_result, my_blast_error = my_process.communicate('through stdin to
stdout')
save_file = open('/Users/patnaik/Desktop/my_blast_error', "w")
save_file.write(my_blast_error)
save_file.close()
save_file = open('/Users/patnaik/Desktop/my_blast_result', "w")
save_file.write(my_blast_result)
save_file.close()
--
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Biopython-dev
mailing list