question

Vincent Lieffroy avatar image
Vincent Lieffroy asked Vincent Lieffroy answered

ImportError: No module named observable in python test SMS,ImportError: No module named observable for SMS quick start

I believe there is missing a folder and file (s) in the RingCentral directory of Github for the Python SDK. I follow this tutorial (SMS Quick Start): https://developers.ringcentral.com/guide/messaging/quick-start#python

I follow the steps outlined:

I am creating an app. Everything is fine.

I am importing the Python RingCentral DSK. Everything is fine.

I create and edit my sms.py file. There too all is well.

But when I run my sms.py file, I get this error message (last line):


ME-python-sdk% python sms.py


Traceback (most recent call last):


File "sms.py", line 1, in <module>


from ringcentral import SDK


File "/Users/ME/ringcentral-python-sdk/ringcentral/__init__.py", line 4, in <module>


from .sdk import SDK


File "/Users/ME/ringcentral-python-sdk/ringcentral/sdk.py", line 4, in <module>


from .platform import Platform


File "/Users/ME/ringcentral-python-sdk/ringcentral/platform/__init__.py", line 5, in <module>


from .platform import Platform


File "/Users/ME/ringcentral-python-sdk/ringcentral/platform/platform.py", line 5, in <module>


from observable import Observable


ImportError: No module named observable



Indeed there is no Observable file / folder

,

But I believe there is missing a folder and file (s) in the RingCentral directory of Github for the Python SDK. I follow this tutorial (SMS Quick Start): https://developers.ringcentral.com/guide/messaging/quick-start#python

I follow the steps outlined:

I am creating an app. Everything is fine.

I am importing the Python RingCentral DSK. Everything is fine.

I create and edit my sms.py file. There too all is well.

But when I run my sms.py file, I get this error message (last line):


ringcentral-python-sdk % python sms.py

Traceback (most recent call last):

File "sms.py", line 1, in <module>

from ringcentral import SDK

File "/Users/ME/ringcentral-python-sdk/ringcentral/__init__.py", line 4, in <module>

from .sdk import SDK

File "/Users/ME/ringcentral-python-sdk/ringcentral/sdk.py", line 4, in <module>

from .platform import Platform

File "/Users/ME/ringcentral-python-sdk/ringcentral/platform/__init__.py", line 5, in <module>

from .platform import Platform

File "/Users/ME/ringcentral-python-sdk/ringcentral/platform/platform.py", line 5, in <module>

from observable import Observable

ImportError: No module named observable


Indeed there is no Observable file / folder

sdk
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Anirban avatar image
Anirban answered

Based on your "ImportError: No module named observable" , can you please check this similar installation issue :

https://community.ringcentral.com/questions/7978/ringcentral-import-error-in-python.html

also you can refer: https://github.com/ringcentral/ringcentral-python to start with.

Hope that help

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Vincent Lieffroy avatar image
Vincent Lieffroy answered
,

Hi !Thanks but it still does not work.


ME@vincent ringcentral-python-sdk % python3 ringout.py

Traceback (most recent call last):

File "/Users/ME/ringcentral-python-sdk/ringcentral/http/client.py", line 28, in send

response.response().raise_for_status()

File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/requests/models.py", line 943, in raise_for_status

raise HTTPError(http_error_msg, response=self)

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://platform.devtest.ringcentral.com/restapi/oauth/token


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

File "/Users/ME/ringcentral-python-sdk/ringout.py", line 15, in <module>

platform.login(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD)

File "/Users/ME/ringcentral-python-sdk/ringcentral/platform/platform.py", line 106, in login

raise e

File "/Users/ME/ringcentral-python-sdk/ringcentral/platform/platform.py", line 100, in login

response = self._request_token(TOKEN_ENDPOINT, body=body)

File "/Users/ME/ringcentral-python-sdk/ringcentral/platform/platform.py", line 173, in _request_token

return self.send_request(request, skip_auth_check=True)

File "/Users/ME/ringcentral-python-sdk/ringcentral/platform/platform.py", line 149, in send_request

return self._client.send(self.inflate_request(request, skip_auth_check=skip_auth_check))

File "/Users/ME/ringcentral-python-sdk/ringcentral/http/client.py", line 34, in send

raise ApiException(response, e)

ringcentral.http.api_exception.ApiException: Invalid resource owner credentials


I guess this is a credential issue ?

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered

Your first problem and second problem are completely different. Don't say "...Thanks but it still does not work."

Your first problem was the "Observable" module was not installed. Simply install the missing lib and try again.

Your second problem is purely about wrong username/password. All you need is to make sure the username, password and extension number (if specified) must be correct. One way to check is to login your account service web (remove the "devtest" if login your production account). If you can login that page with the user credentials, you should be able to login your app using the same credentials.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Vincent Lieffroy avatar image
Vincent Lieffroy answered

Thanks Phong Vu for underlying the two different errors. I did not understand those, hence my previous answer. Of course If i understood I would not have written this answer.

This is clear now, i understand what the problems are. I'll follow your advice to log with the user credentials. I am looking for the library 'Observable', is it in https://github.com/ringcentral/ringcentral-python ? I am unable to locate it.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Vincent Lieffroy avatar image
Vincent Lieffroy answered

Thanks Anirban, i succeeded in running the demo described here https://github.com/grokify/ringcentral-demos-oauth/tree/master/python-bottle until I click on the button on the web page

RingCentral 3-Legged OAuth Demo in Python,

then I have this message : did i miss something ? Thanks in advance

{
  "error" : "invalid_client",
  "errors" : [ {
    "errorCode" : "OAU-113",
    "message" : "No redirect uri is registered for the client"
  } ],
  "error_description" : "No redirect uri is registered for the client"
}
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys