smartsheet api获取工作表方法给出错误

时间:2019-07-09 11:43:53

标签: python smartsheet-api

我是Smartsheet的新用户,正在使用api。 get_sheet行“类型”对象没有属性__getitem__时出现以下错误 请告诉我怎么了。

我看到人们在使用此代码并获得响应。不知道怎么了。

sheet_id='0823....'
smartsheet_client = smartsheet.Smartsheet('6av...')
my_sheet = smartsheet_client.Sheets.get_sheet(sheet_id)

错误:

Traceback (most recent call last):
  File "update.py", line 25, in <module>
    my_sheet = smartsheet_client.Sheets.get_sheet(sheet_id)
  File "C:\Python27\lib\site-packages\smartsheet\sheets.py", line 517, in get_sh
eet
    response = self._base.request(prepped_request, expected, _op)
  File "C:\Python27\lib\site-packages\smartsheet\smartsheet.py", line 243, in re
quest
    native = res.native(expected)
  File "C:\Python27\lib\site-packages\smartsheet\smartsheet.py", line 517, in na
tive
    obj = class_(data, self._base)
  File "C:\Python27\lib\site-packages\smartsheet\models\sheet.py", line 82, in _
_init__
    deserialize(self, props)
  File "C:\Python27\lib\site-packages\smartsheet\util.py", line 130, in deserial
ize
    setattr(obj, key_, value)
  File "C:\Python27\lib\site-packages\smartsheet\models\sheet.py", line 98, in _
_setattr__
    super(Sheet, self).__setattr__(key, value)
  File "C:\Python27\lib\site-packages\smartsheet\models\sheet.py", line 170, in
effective_attachment_options
    self._effective_attachment_options.load(value)
  File "C:\Python27\lib\site-packages\smartsheet\types.py", line 310, in load
    (EnumeratedValue(self.__enum, item)) for item in value
  File "C:\Python27\lib\site-packages\smartsheet\types.py", line 266, in __init_
_
    self.set(value)
  File "C:\Python27\lib\site-packages\smartsheet\types.py", line 275, in set
    self._value = self.__enum[value]
TypeError: 'type' object has no attribute '__getitem__'

1 个答案:

答案 0 :(得分:1)

检查已安装的软件包中的enum34。运行pip list。我不是很肯定,但我相信我以前已经看过,这是缺少枚举的依赖关系。