【问题标题】:smartsheet-python-sdk: AttributeError: module 'smartsheet' has no attribute 'Sheets'smartsheet-python-sdk:AttributeError:模块\'smartsheet\'没有属性\'Sheets\'
【发布时间】:2022-10-12 21:22:55
【问题描述】:

我在 Python 3.10 中收到以下错误:

回溯(最近一次通话最后): 文件“.../smartsheet.py”,第 13 行,在 动作 = smartsheet.Sheets.list_sheets(include_all=True) AttributeError:模块 'smartsheet' 没有属性 'Sheets'

环境: Python 3.10.5(v3.10.5:f377153967,2022 年 6 月 6 日,12:36:10)[Clang 13.0.0 (clang-1300.0.29.30)] Mac OS 12.5,M1 MacBook Pro PyCharm 2022.1.4(专业版) smartsheet-python-sdk-py39 (2.105.1.10) 和 smartsheet-python-sdk (2.177.1)

import smartsheet
import logging

TOKEN = '<<suppressed for security>>'

logging.getLogger('smartsheet').setLevel(logging.CRITICAL)
smart = smartsheet.Smartsheet(access_token=TOKEN)
action = smartsheet.Sheets.list_sheets(include_all=True)
print(action) # Just a placeholder to set a breakpoint

代码是从项目示例中提取出来的,所以我很困惑。任何帮助表示赞赏。

【问题讨论】:

    标签: python python-3.x smartsheet-api-2.0


    【解决方案1】:

    我意识到这是一个老问题,所以你可能已经找到了答案,但我会为任何可能来找的人回答。 “Sheets”(和其他)类通过 smartsheet_client 对象(在您的情况下为“智能”)访问。

    例如:

    import smartsheet
    import logging
    
    TOKEN = '<<suppressed for security>>'
    
    logging.getLogger('smartsheet').setLevel(logging.CRITICAL)
    smart = smartsheet.Smartsheet(access_token=TOKEN)
    action = smart.Sheets.list_sheets(include_all=True) # <--This is the change
    print(action) # Just a placeholder to set a breakpoint
    

    【讨论】:

      猜你喜欢
      • 2022-06-16
      • 2023-02-17
      • 2022-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多