IndexError:元组索引超出范围 - 使用SQLAlchemy时

时间:2017-02-22 07:44:27

标签: python sqlalchemy tuples index-error

当我在打印时使用相同的代码时,一切都很好,但在SQLAlchemy中使用它会给我一个错误:

table = Table(args[1], unixtime_1, datetime_1, args[2].encode('UTF-8'), html_parser.unescape(args[3]).encode('UTF-8'), args[4], v1, v2, v3, v4)
session.add(table)
session.commit() 

这在这里工作正常:

print(args[1], unixtime_1, datetime_1, args[2].encode('UTF-8'), html_parser.unescape(args[3]).encode('UTF-8'), args[4], v1, v2, v3, v4)

有人知道问题是什么吗?提前谢谢!

更新

以下是完整错误:

While firing <function PoloniexComponent.onJoin.<locals>.onTrollbox at 0x7fc2812d4a60> subscribed under 6862132021787864.: Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/txaio/aio.py", line 385, in done
    res = f.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 292, in result
    raise self._exception
  File "/usr/local/lib/python3.5/dist-packages/txaio/aio.py", line 296, in as_future
    res = fun(*args, **kwargs)
  File "/var/www/FlaskApp/FlaskApp/poloniex_pusher.py", line 113, in onTrollbox
IndexError: tuple index out of range

0 个答案:

没有答案