Entering edit mode
11.0 years ago
charles.bridges
▴
70
Hello, writing a script in Python using Biopython modules that will convert Blast XML output to Tabular form. I get an attribute error as follows:
Traceback (most recent call last):
File "C:\Python33\myscripts\Working\Convert_Blast_XML_to_Tabular.py", line 4, in
<module>
from Bio import SearchIO
File "C:\Python33\lib\site-packages\Bio\SearchIO\__init__.py", line 213, in <module>
BiopythonExperimentalWarning)
File "C:\Python33\lib\idlelib\PyShell.py", line 60, in idle_showwarning
file.write(warnings.formatwarning(message, category, filename, lineno, line=line))
AttributeError: 'NoneType' object has no attribute 'write'
Not sure where the problem arises, but I don't think it's my code:
from Bio import SearchIO
import os
blast_out= "some_path"
parsed_out="some_path"
os.chdir(blast_out)
all_files = os.listdir(blast_out)
for single_file in all_files:
print ("Current file is: " + single_file)
#define handles
in_file = single_file
in_fmt = 'blast-xml'
out_file = parsed_out + single_file + '.tab'
out_fmt = 'blast-tab'
out_kwarg = {'comments': True}
SearchIO.convert(in_file, in_fmt, out_file, out_fmt, out_kwargs=out_kwarg)
print ("\nFinished Parsing File.\n")
This seems to be an issue with pyshell, rather than biopython. Can you use python without it (I've never used python on Windows)?
Edit: It's likely that this is the bug in question and it's been open for a while. I expect this will take a while to get resolved since so few people actually try to program in python on Windows. In reality, I suspect that just modifying PyShell.py to change stderr might fix this.
Yes, I can use python without using any Biopython modules. Any suggestions to modify PyShell.py?
I actually wanted to know if you can use biopython (or python in general) without using the Idle interface on windows. For editing PyShell.py, you might just have a look at this thread on stackoverflow.