td-ameritrade-python-api icon indicating copy to clipboard operation
td-ameritrade-python-api copied to clipboard

Error while connectiong to tdstream: AttributeError: module 'websockets' has no attribute 'client'

Open saber-be opened this issue 2 years ago • 2 comments

I'm trying to connect to the stream on ubuntu 20.04 and python3.8 Traceback (most recent call last): ... File "services/TDAmery/AccountActivityStreamListener.py", line 18, in read_stream await stream_client.build_pipeline() File "/home/ubuntu/news-miner/venv/lib/python3.8/site-packages/td/stream.py", line 500, in build_pipeline await self._connect() File "/home/ubuntu/news-miner/venv/lib/python3.8/site-packages/td/stream.py", line 631, in _connect self.connection = await websockets.client.connect(self.websocket_url) File "/home/ubuntu/news-miner/venv/lib/python3.8/site-packages/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'

I fixed this issue by adding this line to td/stream.py line 14:

import websockets.client

If it's ok, I'll create a pull request.

saber-be avatar Apr 06 '22 08:04 saber-be

This fixed my issue too.

Boggartfly avatar Apr 12 '22 23:04 Boggartfly

Same here, fixed my issue.

sopko16 avatar Jul 25 '22 01:07 sopko16