在谷歌云平台的虚拟实例中执行 python 脚本时出现 Python 错误

我有一个从金融市场获取实时股票价格的 python 脚本。当它在谷歌云平台的虚拟实例环境中通过 crontab 进行调度时,我收到此错误日志:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pandas/core/indexes/base.py",line 3078,in get_loc
    return self._engine.get_loc(key)
  File "pandas/_libs/index.pyx",line 140,in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx",line 162,in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi",line 1492,in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi",line 1500,in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 0

如果通过我的笔记本电脑执行相同的脚本,则不会出现上述错误。任何可能的指针,python 代码有什么问题?

代码:

def getPriceBySymbol(fyersSymbol):
    df = config.FYERS_SYMBOLMAP 
    symbol_row= df[df['Symbol'] == fyersSymbol].iloc[0] strike = symbol_row['STRIKE'] opt_type = symbol_row['OPT_TYPE'] 
    return getStrikeLtp(strike,opt_type)

lidwbbg 回答:在谷歌云平台的虚拟实例中执行 python 脚本时出现 Python 错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/425.html

大家都在问