admin管理员组文章数量:1289557
I wrote a python project that automates tasks and makes use of the smartsheet api but when I package this project into an executable with nuitka I get the error:
ImportError! Could not load api or model class Search
Error: 'str' object has no attribute 'search_sheet'
this is the piece of code that throws this error
from smartsheet import smartsheet
...
smart = smartsheet.Smartsheet("api key",proxies=proxies) # Create a Smartsheet client
response = smart.errors_as_exceptions(True) # Call the list_sheets() function and store the response object
NonFoundSerialNumbers=""
try:
SerialNumbers=SerialNumbers.split(" ")
for search in SerialNumbers:
response=smart.Search.search_sheet(sheetID,search)
if len(response.results)==0:
NonFoundSerialNumbers=NonFoundSerialNumbers+"\n"+search
etc ...
This error makes me believe that the smartsheet client is not being created due to an import error of some sort when packaging the project. This is my yaml file for reference:
# nuitka.yaml
# Main configuration for the Nuitka build
- module-name: Helper
nuitka:
# Project Information
...
standalone: true
onefile: true
# Entry point for the application
entry_point: "Helper.py"
# Include packages and modules
include_packages:
- UI
- Core
- Scripts
- PIL # Pillow
- cv2 # opencv-python
include_modules:
- mss
- pytesseract
- requests
- json
- keyboard
- MouseInfo
- PyDirectInput
- PyGetWindow
- PyMsgBox
- pyperclip
- PyRect
- PyScreeze
- python_dateutil
- pytweening
- pywin32
- requests_toolbelt
- setuptools
- six
- smartsheet_python_sdk
- smartsheet
- tqdm
- zstandard
- urllib3
- tzdata
- certifi
- charset_normalizer # Included from requirements
- idna # Included from requirements
- smartsheet.models
- smartsheet.sheets
- smartsheet.search
- smartsheet.attachments
- smartsheet.saml
- smartsheet.groups
- smartsheet.reports
- smartsheet.sights
- smartsheet.workspaces
- smartsheet.Smartsheet
- smartsheet.search_sheet
# Include data directories and files
include_data_dirs:
- Resources=. # Put Resources directory at the root of the extracted executable environment
# Windows specific settings (optional)
windows:
icon_from_ico: "./Resources/Pictures/HammerIcon.ico"
# Plugins
plugins:
- tk_inter # Tkinter and CustomTkinter
And this is the command I'm running
nuitka --standalone --onefile --enable-plugin=tk-inter --follow-imports --user-package-configuration-file=Helper.yaml Helper.py
Note: Everything works perfectly when running the project from my editor
本文标签: Not able to use Smartsheet python api when packaging project using NuitkaStack Overflow
版权声明:本文标题:Not able to use Smartsheet python api when packaging project using Nuitka - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741474484a2380799.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论