danpaquin / coinbasepro-python

The unofficial Python client for the Coinbase Pro API
MIT License
1.82k stars 740 forks source link

'NoneType' object has no attribute 'join' #411

Open Cristianistrate opened 3 years ago

Cristianistrate commented 3 years ago

on example: import cbpro

Parameters are optional

wsClient = cbpro.WebsocketClient(url="wss://ws-feed.pro.coinbase.com", products="BTC-USD", channels=["ticker"])

Do other stuff...

wsClient.close()

i get this error:

File "C:\Python3\lib\site-packages\cbpro\websocket_client.py", line 104, in close self.thread.join() AttributeError: 'NoneType' object has no attribute 'join'

Please advise

jchapman0511 commented 3 years ago

I am also having this issue. Have you found a fix yet or are we waiting for someone to help still? Thanks!

ElliotSknr commented 3 years ago

This is occurring as you have not yet started listening. You must first call .start() before calling .close()

Example Usage:

import cbpro
wsClient = cbpro.WebsocketClient(url="wss://ws-feed.pro.coinbase.com",
                                 products=["BTC-USD"],
                                 channels=["ticker"])

wsClient.start()

#  Do stuff here, sleeping for example
time.sleep(10)

wsClient.close()