sinricpro / python-sdk

python3 sdk for sinric pro.
https://sinric.pro
23 stars 9 forks source link

Cant get the sdk to run #30

Open devguyplus opened 3 years ago

devguyplus commented 3 years ago

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'

jamesbob1 commented 3 years ago

Try adding import websockets before the sinric imports.

devguyplus commented 3 years ago

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.

kakopappa commented 3 years ago

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.

bsalinas commented 3 years ago

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.

dhilmer commented 2 years ago

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