pythonattributesexesmartsheet-api

Method get_cell_history (Smartsheet API) works in Python file but doesn't work in exe file


lst_Incor = []
for i in range(250):
    if get_cell_value_by_column_id(sheet_Source.rows[i],450382123898xxxx) == 'Incorporating US Markup':
        response = smart.Cells.get_cell_history(
          SheetId_Source,       # sheet_id
          sheet_Source.rows[i].id,       # row_id
          450382123898xxxx,       # column_id
          include_all=True)
        revisions = response.data
        lst_Incor.append(str(revisions[0].modified_at)[:10])
    else:
        lst_Incor.append('')
print(lst_Incor)

I used the above code to check the history of cells and retrieve their respective dates. While the code worked smoothly in a Python file, I encountered an issue when I run exe file converted by pysintaller. Exe file didn't work. The error message indicated that 'str' objects do not have the attribute 'get_cell_history' in console window

How can I handle with his problem. enter image description here

I do not know the reasons

Thank you everyone so much


Solution

  • This type of issue has been reported before here in Stackoverflow. In those cases, the solution was to add import statements for the Smartsheet objects your code is using. In your case (for the code you’ve posted above) that’d mean adding the import statement:

    import smart.Cells

    For more info about this issue, see these other posts: