StupidBeauty
Read times:1286Posted at:Sun May 29 05:28:05 2011
- no title specified

TypeError: 'module' object is not callable,还是本座的疏忽导致的

今天在研究 BioPython教程里面的一个代码。把它写到脚本里面一运行啊 ,出现咯错误:

bash-4.1# python Translate1.py

Traceback (most recent call last):

  File "Translate1.py", line 7, in <module>

    my_seq=Seq("GATCGATGGGCCTATATAGGATCGAAAATCGC",IUPAC.unambiguous_dna)

TypeError: 'module' object is not callable

上古鸽一搜索 ,说的大多是导入模块时写得有问题 。于是本座仔细检查咯一下自己保存到脚本中的代码,果然 ,有一句少写了一点东西

本座写入的脚本是

#!/usr/bin/python

#coding:utf-8

from Bio import Seq

from Bio.Alphabet import IUPAC

my_seq=Seq("GATCGATGGGCCTATATAGGATCGAAAATCGC",IUPAC.unambiguous_dna)

print my_seq

而教程里面是

#!/usr/bin/python

#coding:utf-8

from Bio.Seq import Seq

from Bio.Alphabet import IUPAC

my_seq=Seq("GATCGATGGGCCTATATAGGATCGAAAATCGC",IUPAC.unambiguous_dna)

print my_seq

原来是本座抄代码的时候漏咯一个 “Seq”。

也就是说 ,my_seq实际上是一个Bio.Seq.Seq对象。

改过来之后,就好咯

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands