AttributeError:'int'对象没有属性'state'

时间:2013-02-24 22:54:32

标签: python python-2.7 compiler-errors runtime-error

当我运行我目前拥有的代码时会弹出此错误。 注意:我没有编写代码,我只是想了解发生了什么,以便我可以将它移植到更新版本的TuLiP。

Traceback (most recent call last):
  File "vms5.py", line 270, in <module>
    states = [aut_state.state]
AttributeError: 'int' object has no attribute 'state'
第270行说:

states = [aut_state.state]

我尝试寻找state并找到了这个 第249行:

state = dict(temp = Tmax, w = 0, h = 0, b = Bmax, a = 0, c = 0, nw = 0)
第259行和第260行

aut_state

aut = createAut(aut_file = autfile, varnames = env_vars.keys() + sys_disc_vars.keys())
aut_state = aut.findNextAutState(current_aut_state=None, env_state=state)

aut

的其他字词

第47行:

autfile = testfile+'.aut'

和第223-234行

# Check realizability
realizability = jtlvint.checkRealizability(smv_file=smvfile, spc_file=spcfile, \
                                           aut_file=autfile, verbose=3)

# Compute an automaton
jtlvint.computeStrategy(smv_file=smvfile, spc_file=spcfile, aut_file=autfile, \
                        priority_kind=3, verbose=3)
aut = automaton.Automaton(autfile, [], 3)

代码中包含aut相关字词

的所有内容

如果您想了解更多信息,请告诉我

编辑

我尝试在第270行之前添加print(aut_state)并获得-1作为答案。

2 个答案:

答案 0 :(得分:0)

所以aut是一个int。 Ints没有名为state的属性。无论设置变量aut,都用int设置它。看起来像我的错误代码。查看findNextAutState的代码 - 当没有更多AutStates时它会返回什么? -1

可能缺少条件检查。

答案 1 :(得分:0)

从回溯

可以清楚地看出aut_state是一个整数,而整数不能有任何名为state的属性。您的主要代码问题位于创建自动对象的createAut()内部或findNextAutState()函数内部,该函数返回aut_state

相关问题