1

I am trying to parse a fasta file in Biopython using the following code.How can I solve this error?

from Bio import SeqIO
handle = open("C:/Users/Desktop/kk.fasta", "rU")



File "<pyshell#19>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'kk.fasta'

I am getting the above error. But my file is already there. I am using windows7 OS , python 2.7 and Biopython 1.57. Any suggestions please.

4

2 回答 2

2

尝试:

import os
print os.path.isfile(r"C:\Users\Desktop\kk.fasta")

如果输出为真,可以尝试替换原代码中的字符串,看看是否有效。如果没有,请确保路径中没有拼写错误。

小的r意味着生的。它将全部转义\\\确保路径有效(\n 不会成为换行符)

于 2011-11-05T07:10:34.680 回答
0

你的路径是错误的。

打开资源管理器并放入此路径:

c:\Users\

这可能会帮助您更正路径。用户下面的下一个目录将是用户名或默认值,而不是桌面。

于 2011-11-05T06:46:50.450 回答