Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

"ImportError! Could not load api or model class shape" using 3.7.12 and 3.8.12 #171

Open
mnissman opened this issue Nov 1, 2021 · 4 comments

Comments

@mnissman
Copy link

mnissman commented Nov 1, 2021

I am not able to get smartsheet-python-sdk latest version (2.105.1) to work with python version 3.7.12 or 3.8.12. The following intro code give me the error "ImportError! Could not load api or model class shape". access_token created through my smartsheet account and defined in the environment.

import smartsheet
smartsheet_client = smartsheet.Smartsheet(access_token)

I see the package lists support for 3.6. My Mac running Big Sur on Intel chip doesn't support 3.6. I would be very happy to be able to use the package. Is there any intention to add support for newer python versions, especially since 3.6 is reaching EOL at the end of 2021?

Thanks.

@andrewtmendoza
Copy link

Same issue, any luck?

@RCoff
Copy link
Contributor

RCoff commented Dec 7, 2021

@mnissman Can you provide the exception traceback for this?

@mnissman
Copy link
Author

mnissman commented Dec 9, 2021

@RCoff, @andrewtmendoza Thanks for your interest. The error seems to be IDE related (I'm using pyCharm) and does not occur in Python shell.

In the IDE, upon initialization of the smartsheet client in my originally posted code, I get the error below printed. Any subsequent calls through the client have the same printed error. However, the code is still running and returning corrrect results as far as I can tell.

smartsheet_client = smartsheet.Smartsheet(access_token=access_token)
ImportError! Could not load api or model class shape
ImportError! Could not load api or model class shape
ImportError! Could not load api or model class shape
ImportError! Could not load api or model class shape
ImportError! Could not load api or model class shape
ImportError! Could not load api or model class shape

I tried suppressing the error but it does nothing. I guess it is more of an annoyance now that I figured out the code is actually returning the right results and is only IDE related.

from contextlib import suppress
for sheet in sheets:
    with suppress(ImportError):
        print(sheet.id)
7711112721393540
8321868345173892
1053171993864068
2081613187180420
1003518950696836
5556771621234564
5459312907708292
6070068531488644
3867921760970628
6585212814550916
5507118578067332
8085930759219076
352456979834756
3207513094023044
3818268717803396
8371521388341124
ImportError! Could not load api or model class shape
ImportError! Could not load api or model class shape
ImportError! Could not load api or model class shape
ImportError! Could not load api or model class shape
ImportError! Could not load api or model class shape
ImportError! Could not load api or model class shape

@RCoff
Copy link
Contributor

RCoff commented Dec 13, 2021

I see now! I have also ran into this issue frequently when using the PyCharm debugger.

According to this SO article, the issue is related to ipython: https://stackoverflow.com/questions/57118472/python-for-smartsheet-getting-ipython-canary-method-should-not-exist

To mitigate this, I usually disable logging for the Smartsheet library.

import logging
logging.getLogger('smartsheet').setLevel(logging.CRITICAL)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants