所以我正在开发一个Twitter机器人,在异常期间我遇到一个导致程序停止的错误。我不确定是什么导致它。
我一直在寻找解决方法,但没有运气。
任何人都有机会发现这个问题。
$('#auth_password').hover(function () {
$('#auth_password').attr('type', 'text');
}, function () {
$('#auth_password').attr('type', 'password');
}
);
$('#priv_password').hover(function () {
$('#priv_password').attr('type', 'text');
}, function () {
$('#priv_password').attr('type', 'password');
}
);
$('#auth_password, #priv_password').change( function(e){
console.log('pass changed');
});
它给我的错误如下:
except tweepy.error.TweepError as e:
error_code = list(e)[0][0].get('code')
if error_code == 327:
print('no need')
elif error_code == 88:
print('wait 16 minutes we have hit limit')
time.sleep(15 * 60)
elif error_code == 226:
print('STOP')
time.sleep(15 * 60)
elif error_code == 261:
print(' banned')
else:
print(str(e))
except AttributeError as e:
print('Something bad has happened')
except Error as e:
print(str(e))
任何帮助都会很棒。
答案 0 :(得分:2)
发布完整的堆栈跟踪很有帮助,但在这种情况下,它可以在没有的情况下进行诊断。
在第2行,您调用list(e)
,但list
期望可以迭代以生成列表。在这个API上进行一次谷歌搜索让我相信你真正想要的是行
error_code = e.api_code