【发布时间】:2016-08-17 15:49:09
【问题描述】:
我使用 smartsheet SDK 开发了一个 Python 2.7 应用程序,它在你的机器上运行良好。然后我通过 PyInstaller 将它捆绑到一个应用程序中,当我运行它时出现此错误:
DEBUG:smartsheet.smartsheet:try loading api class Home
DEBUG:smartsheet.smartsheet:try loading model class Home
DEBUG:smartsheet.smartsheet:ImportError! Cound not load api or model
class Home Exception in Tkinter callback Traceback (most recent call
last): File "lib-tk/Tkinter.py", line 1536, in __call__ File
"pacers.py", line 166, in log_processing File "pacers.py", line 57,
in new_sheet AttributeError: 'str' object has no attribute
'create_sheet'
编辑 1:
这是我无法理解的 AttributeError。在此之前,我可以毫无问题地创建其他智能表对象。并且运行源代码不会出现问题。有什么想法吗?
它从源代码工作得很好! -->
DEBUG:smartsheet.smartsheet:try loading api class Home
DEBUG:smartsheet.smartsheet:loaded instance of api class Home
DEBUG:smartsheet.models.column:deleting index from obj (filter: create_sheet)
DEBUG:smartsheet.models.column:deleting locked from obj (filter: create_sheet)
编辑 2:
原来 PyInstaller 没有正确导入所有模块,必须显式导入对象,例如smartsheet.首页
【问题讨论】:
-
你能发一个minimal, complete, and verifiable example你的代码吗?
-
谢谢,但想通了!
-
那么请在下面添加解决方案作为答案。
标签: python api pyinstaller smartsheet-api