python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

Cant get the sdk to run

Open devguyplus opened this issue 2 years ago • 5 comments

Hi, I have copied the basic example from the readme file, and filled all the details required. After running it, it returns the following error:

File "sinric\_sinricprosocket.py", line 33, in connect self.connection = await websockets.client.connect('ws://ws.sinric.pro', File "\websockets\imports.py", line 92, in __getattr__ raise AttributeError(f"module {package!r} has no attribute {name!r}") AttributeError: module 'websockets' has no attribute 'client'

devguyplus avatar Sep 23 '21 16:09 devguyplus

Try adding import websockets before the sinric imports.

jamesbob1 avatar Sep 23 '21 18:09 jamesbob1

Try adding import websockets before the sinric imports.

Like this? import websockets from sinric import SinricPro from sinric import SinricProUdp import asyncio

It returned the same error.

devguyplus avatar Sep 23 '21 18:09 devguyplus

have you installed WebSockets?

pip install websocket-client

On Fri, Sep 24, 2021 at 1:22 AM Ofir @.***> wrote:

Try adding import websockets before the sinric imports.

Like this? import websockets from sinric import SinricPro from sinric import SinricProUdp import asyncio

It returned the same error.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sinricpro/python-sdk/issues/30#issuecomment-926050419, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZUXMXE4JB2K73RM6YLUDNV7LANCNFSM5EUD766Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

kakopappa avatar Sep 23 '21 22:09 kakopappa

For what its worth, I ran into the same problem just now. In particular, it looks like pip was installing version 2.4.1 of sinricpro which has the line

self.connection = await websockets.client.connect('ws://ws.sinric.pro',

(and imports for import websockets).

It looks like in version 2.4.2, there were some changes to _sinricprosocket.py which switched to imports like

from websockets import client

Manually making those changes in my local copy of _sinricprosocket.py got the examples to run for me.

I am running python 3.9.1.

I am not sure if this is related, but I thought I would mention it in case it was a helpful observation.

bsalinas avatar Sep 26 '21 20:09 bsalinas

Thanks @bsalinas I was having the same issue and that worked for me!

dhilmer avatar Jan 14 '22 18:01 dhilmer