import smartsheet.sheets
import smartsheet.folders
# Smartsheet client acess token
smartsheet_client = smartsheet.Smartsheet("api_key")
I recently switched my laptop, for some reason I am receiving error message as below every time I run above script:
Traceback (most recent call last):
File "c:\Users\yuero\OneDrive - Amer Sports\Desktop\Work\Product Data Ops\Projects\Python Projects\excel2smartsheet\excel2smartsheet.py", line 8, in <module>
smartsheet_client = smartsheet.Smartsheet("api_key")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\yuero\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\smartsheet\smartsheet.py", line 167, in __init__
self._session = pinned_session(pool_maxsize=max_connections)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\yuero\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\smartsheet\session.py", line 56, in pinned_session
total=1, method_whitelist=Retry.DEFAULT_METHOD_WHITELIST.union(["POST"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Retry' has no attribute 'DEFAULT_METHOD_WHITELIST'
I can confirm that there is no issue with other scripts in my new laptop, and I am still able to run this program in old laptop, I can confirm that I have Smartsheet Python package setup.
Thanks!
I'd suspect that this is happening because your new laptop has a newer version of the urllib3
package installed than your previous laptop. Looks like Retry.DEFAULT_METHOD_WHITELIST
was deprecated in version 1.26.0 of urllib3
and removed altogether in version 2.0. (See here for history of that package).
I'd suggest that you try installing an older version of the urllib3
package on your new laptop, to see if that fixes the problem. For what it's worth, I have version 1.26.2 of urllib3
installed on my machine and am not having any issues using the Smartsheet Python SDK.