私は約 1 年間 biopython に手を出しており、最近 Biopython リリース 1.59 にアップグレードしました。いくつかのチュートリアルでスキルを更新していますが、for ループと biopython ライブラリのモジュールを実行すると、常に以下のエラーが発生します。
IndentationError: expected an indented block
コマンド ライン ターミナルから Komodo Edit バージョン 7.0.2 で記述された .py ファイルを呼び出した場合にのみ、このエラーが発生します。
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
コマンド ラインを使用して、上記のように 1 年前に作成した古い .py ファイルを呼び出すと、正常に動作します。Python を直接起動し、チュートリアルの例を 1 行ずつ入力すると、正常に動作します。
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 ファイルを修正するにはどうすればよいですか?
この問題についての洞察をいただければ幸いです。
プリヤ