我正在玩python中的Dragonfly lib。我正在使用Windows7 + python2.6。然而,當我嘗試運行演示代碼(這是從蜻蜓爲例)在python2.6上使用python蜻蜓python2.6問題
from dragonfly.all import Grammar, CompoundRule
# Voice command rule combining spoken form and recognition processing.
class ExampleRule(CompoundRule):
spec = "do something computer" # Spoken form of command.
def _process_recognition(self, node, extras): # Callback when command is spoken.
print "Voice command spoken."
# Create a grammar which contains and loads the command rule.
grammar = Grammar("example grammar") # Create a grammar to contain the command rule.
grammar.add_rule(ExampleRule()) # Add the command rule to the grammar.
grammar.load() # Load the grammar.
我收到以下錯誤:
Traceback (most recent call last):
File "test.py", line 2, in <module>
from dragonfly.all import Grammar, CompoundRule
ImportError: No module named all
我怎樣才能解決呢?
上面的演示腳本是否保存爲「dragonfly.py」? –
它被保存爲test.py – SKulibin