Python报错typeError: 'tuple' object is not callable 10
ERROR:lexicon_tests.test_errors------------------------------------------------------...
ERROR: lexicon_tests.test_errors----------------------------------------------------------------------Traceback (most recent call last): File "/Library/Python/2.7/site-packages/nose-1.3.7-py2.7.egg/nose/case.py", line 197, in runTest self.test(*self.arg) File "/Users/admin/mystuff/test/lexicon_tests.py", line 42, in test_errors ('error', 'IAS')TypeError: 'tuple' object is not callable----------------------------------------------------------------------Ran 9 tests in 0.118sFAILED (errors=6)
展开
1个回答
展开全部
环境:python2.7
百度下,只有几个例子,有个说是某个函数被重新定义了,导致出问题。
我仔细看了下我的错误:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/eventlet-0.14.0-py2.7.egg/eventlet/hubs/hub.py", line 346, in fire_timers
timer()
File "/usr/local/lib/python2.7/dist-packages/eventlet-0.14.0-py2.7.egg/eventlet/hubs/timer.py", line 56, in __call__
cb(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/eventlet-0.14.0-py2.7.egg/eventlet/greenthread.py", line 194, in main
result = function(*args, **kwargs)
TypeError: 'tuple' object is not callable
然后通过一步步查询找到出错语句:
eventlet.spawn(utils.command(cmd))
在自定义的utils.command中,有调用subprocess.Popen和eventlet.sleep,可能是其中哪个出问题了
我因为对结果要求不高,直接将代码改为:
utils.command(cmd)
然后不再出错。
没有进一步查看原先的错处,个人考虑是某个函数重定义导致错误,不过网上也有代码不规范出错的
百度下,只有几个例子,有个说是某个函数被重新定义了,导致出问题。
我仔细看了下我的错误:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/eventlet-0.14.0-py2.7.egg/eventlet/hubs/hub.py", line 346, in fire_timers
timer()
File "/usr/local/lib/python2.7/dist-packages/eventlet-0.14.0-py2.7.egg/eventlet/hubs/timer.py", line 56, in __call__
cb(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/eventlet-0.14.0-py2.7.egg/eventlet/greenthread.py", line 194, in main
result = function(*args, **kwargs)
TypeError: 'tuple' object is not callable
然后通过一步步查询找到出错语句:
eventlet.spawn(utils.command(cmd))
在自定义的utils.command中,有调用subprocess.Popen和eventlet.sleep,可能是其中哪个出问题了
我因为对结果要求不高,直接将代码改为:
utils.command(cmd)
然后不再出错。
没有进一步查看原先的错处,个人考虑是某个函数重定义导致错误,不过网上也有代码不规范出错的
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询