1
嘗試使用Python 2.7獲取Windows 10中的蜻蜓工作。我有我做的,我嘗試但得到的工作而言,我發現了以下錯誤的樣本模塊:蜻蜓IntegerRef獲取TypeError:'NoneType'對象不可調用錯誤
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()
沒有人知道我可能做錯了嗎?
你的樣品模塊從哪裏來?在此之前你有任何錯誤信息嗎? –
原來是從這裏:http://dragonfly.readthedocs.org/en/latest/rules.html#id1我改變了'整數'爲'IntegerRef',因爲我得到了另一個'整數'錯誤。在這之前沒有錯誤信息。 – Jarrett
原始錯誤(使用'Integer')爲: 'Traceback(最近一次調用最後一個): loadFile中的文件「C:\ NatLink \ NatLink \ MacroSystem \ core \ natlinkmain.py」,第304行imp.load_module (modName,fndFile,fndName,fndDesc) 文件「C:\ Users \ jarrett \ projects \ natlink \ _test.py」,第3行, class ExampleRule2(MappingRule): 文件「C:\ Users \ jarrett \項目\ natlink \ _test.py「,第20行,ExampleRule2 Integer(」n「,1,20), TypeError:'NoneType'對象不可調用' –
Jarrett