我一直参与biopython大约一年,最近我升级到Biopython版本1.59。我一直在刷新我的技能与一些教程,但我总是当我运行一个for循环下面的错误,并从biopython库中的任何模块:Biopython缩进错误
IndentationError: expected an indented block
我只当我所说的.py文件得到这个错误写在科莫多编辑7.0.2版的命令行终端:
Priyas-iMac:~ Priya$ python /Users/priya/Documents/Python/Tutorials/BioParse.py
Traceback (most recent call last):
File "/Users/priya/Documents/Python/Tutorials/BioParse.py", line 4, in <module>
SeqIO.write(rc, "/Users/priya/Documents/Python/Tutorials/ls_orchid_rc.fasta", "fasta")
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/SeqIO/__init__.py", line 400, in write
from Bio import AlignIO
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/AlignIO/__init__.py", line 147, in <module>
import NexusIO
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/AlignIO/NexusIO.py", line 19, in <module>
from Bio.Nexus import Nexus
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/Nexus/Nexus.py", line 15, in <module>
import os,sys, math, random, copy
File "/Users/Priya/Documents/Python/Tutorials/random.py", line 27
randLowHigh(5,10)
^
IndentationError: expected an indented block
当我使用命令行来调用,我一年前写了如上它们运行良好的老.py文件。当我直接和类型启动蟒蛇在教程示例一行行正常工作:
Priyas-iMac:~ Priya$ python
Python 2.7.3 (default, Apr 19 2012, 00:55:09)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from Bio import SeqIO
>>> for seq_record in SeqIO.parse("/Users/priya/Documents/Python/Tutorials/ls_orchid.txt","fasta"):
... print seq_record.id
...
gi|2765658|emb|Z78533.1|CIZ78533
gi|2765657|emb|Z78532.1|CCZ78532
如何解决我的.py文件这样我就可以从终端运行呢?
任何有关这个问题的见解将不胜感激!
普里亚
你能发布.py文件吗?也许,你忘了缩进第27行。 –
我不确定如何直接发布文件,你能告诉我怎么做吗? – priyasshah