Problems using python dragonfly on windows7 with python2.6

348 Views Asked by At

I am playing with the Dragonfly lib in python. I am working on Windows7 + python2.6. However when I try to run demo code (which is the example from Dragonfly)

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.

I receive the following error:

Traceback (most recent call last):
  File "test.py", line 2, in <module>
    from dragonfly.all import Grammar, CompoundRule
ImportError: No module named all

How can I fix it?

1

There are 1 best solutions below

7
synkarius On

Get rid of .all. That example seems to be outdated. It should look like this:

from dragonfly import Grammar, CompoundRule