AttributeError: 'module' object has no attribute 'WebSocketApp' AttributeError: 'module' object has no attribute 'WebSocketApp' json json

AttributeError: 'module' object has no attribute 'WebSocketApp'


It looks like you're trying to use features of the websocket-client package and not just the websocket package. Pip-install websocket-client from the command line (or install it using whatever other package manager you have), then try running your code again.

pip install websocket-client


In this case, You should uninstall the possible inconsistent previous versions and install websocket-client again:

pip uninstall websocket-clientpip uninstall websocket

an then install a new version:

pip install websocket-client


Make sure that you didn't name your file as websocket.py; Otherwise, it will prevent import of the desired third-party module websocket; because your module is searched first according to sys.path module search path.

Rename your module to other name, and make sure to clean websocket.pyc if there it is.