问题描述
我使用 smartsheet SDK 开发了一个 Python 2.7 应用程序,它在 y 机器上运行良好.然后我通过 PyInstaller 将它捆绑到一个应用程序中,当我运行它时出现此错误:
I developed a Python 2.7 app using the smartsheet SDK and it works fine on y machine. Then I bundle it into an app via PyInstaller and I get this error when I run it:
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.在此之前,我可以毫无问题地创建其他智能表对象.并且运行源代码不会出现问题.有什么想法吗?
It's this AttributeError that I can't get my head around. I'm able to create other smartsheet objects before this with no problem. And running the source code doesn't present a problem. Any ideas?
它从源头上运行得很好!-->
It works from source just fine! -->
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.Home
Turns out PyInstaller wasn't importing all of the module properly, had to explicitly import objects, e.g. smartsheet.Home
推荐答案
我遇到了类似的问题,
为了解决我使用 from smartsheet import Smartsheet
而不是 import smartsheet
To resolve I used from smartsheet import Smartsheet
instead of import smartsheet
这篇关于通过 pyinstaller 在捆绑的应用程序中包含 smartsheet sdk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!