Dragonfly IntegerRef getting a TypeError: 'NoneType' object is not callable error
Dragonfly IntegerRef getting a TypeError: 'NoneType' object is not callable error
尝试让蜻蜓在 Windows 10 和 Python 2.7 中工作。我有一个我制作的示例模块,我试图开始工作,但是我收到以下错误:
Traceback (most recent call last):
File "C:\NatLink\NatLink\MacroSystem\core\natlinkmain.py", line 304, in loadFile
imp.load_module(modName,fndFile,fndName,fndDesc)
File "C:\Users\jarrett\projects\natlink\_test.py", line 3, in <module>
class ExampleRule2(MappingRule):
File "C:\Users\jarrett\projects\natlink\_test.py", line 20, in ExampleRule2
IntegerRef("n", 1, 20),
File "C:\Python27\lib\site-packages\dragonfly-0.6.5-py2.7.egg\dragonfly\grammar\number.py", line 75, in __init__
element = self._element_type(None, min, max)
TypeError: 'NoneType' object is not callable
产生这个错误的代码是:
from dragonfly.all import Grammar, CompoundRule, MappingRule, Key, Text, IntegerRef, Dictation
class ExampleRule2(MappingRule):
mapping = {
"[feed] address [bar]": Key("a-d"),
"subscribe [[to] [this] feed]": Key("a-u"),
"paste [feed] address": Key("a-d, c-v, enter"),
"feeds | feed (list | window | win)": Key("a-d, tab:2, s-tab"),
"down [<n>] (feed | feeds)": Key("a-d, tab:2, s-tab, down:%(n)d"),
"up [<n>] (feed | feeds)": Key("a-d, tab:2, s-tab, up:%(n)d"),
"open [item]": Key("a-d, tab:2, c-s"),
"newer [<n>]": Key("a-d, tab:2, up:%(n)d"),
"older [<n>]": Key("a-d, tab:2, down:%(n)d"),
"mark all [as] read": Key("cs-r"),
"mark all [as] unread": Key("cs-u"),
"search [bar]": Key("a-s"),
"search [for] <text>": Key("a-s") + Text("%(text)s\n"),
}
extras = [
IntegerRef("n", 1, 20),
Dictation("text"),
]
defaults = {
"n": 1,
}
# Create a grammar which contains and loads the command rule.
grammar = Grammar("example grammar")
grammar.add_rule(ExampleRule2())
grammar.load()
有谁知道我做错了什么吗?
事实证明这是我的语言问题——我的语言被设置为蜻蜓 natlink 引擎中未定义的语言。
我手动添加语言后,一切正常。
尝试让蜻蜓在 Windows 10 和 Python 2.7 中工作。我有一个我制作的示例模块,我试图开始工作,但是我收到以下错误:
Traceback (most recent call last):
File "C:\NatLink\NatLink\MacroSystem\core\natlinkmain.py", line 304, in loadFile
imp.load_module(modName,fndFile,fndName,fndDesc)
File "C:\Users\jarrett\projects\natlink\_test.py", line 3, in <module>
class ExampleRule2(MappingRule):
File "C:\Users\jarrett\projects\natlink\_test.py", line 20, in ExampleRule2
IntegerRef("n", 1, 20),
File "C:\Python27\lib\site-packages\dragonfly-0.6.5-py2.7.egg\dragonfly\grammar\number.py", line 75, in __init__
element = self._element_type(None, min, max)
TypeError: 'NoneType' object is not callable
产生这个错误的代码是:
from dragonfly.all import Grammar, CompoundRule, MappingRule, Key, Text, IntegerRef, Dictation
class ExampleRule2(MappingRule):
mapping = {
"[feed] address [bar]": Key("a-d"),
"subscribe [[to] [this] feed]": Key("a-u"),
"paste [feed] address": Key("a-d, c-v, enter"),
"feeds | feed (list | window | win)": Key("a-d, tab:2, s-tab"),
"down [<n>] (feed | feeds)": Key("a-d, tab:2, s-tab, down:%(n)d"),
"up [<n>] (feed | feeds)": Key("a-d, tab:2, s-tab, up:%(n)d"),
"open [item]": Key("a-d, tab:2, c-s"),
"newer [<n>]": Key("a-d, tab:2, up:%(n)d"),
"older [<n>]": Key("a-d, tab:2, down:%(n)d"),
"mark all [as] read": Key("cs-r"),
"mark all [as] unread": Key("cs-u"),
"search [bar]": Key("a-s"),
"search [for] <text>": Key("a-s") + Text("%(text)s\n"),
}
extras = [
IntegerRef("n", 1, 20),
Dictation("text"),
]
defaults = {
"n": 1,
}
# Create a grammar which contains and loads the command rule.
grammar = Grammar("example grammar")
grammar.add_rule(ExampleRule2())
grammar.load()
有谁知道我做错了什么吗?
事实证明这是我的语言问题——我的语言被设置为蜻蜓 natlink 引擎中未定义的语言。
我手动添加语言后,一切正常。