Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am getting Attribute error: 'module' object has no attribute 'enableTrace' while running a python code

I am using python 2.7 and I have installed the module websocket-client 0.40.0 but I am getting the attribute error as I mentioned above.

This is my code, I am trying to connect my PC to a microcontroller board through websocket

import websocket
import nltk
from nltk.tokenize import PunktSentenceTokenizer
import sys
import urllib
import urlparse
from urllib2 import HTTPError
from urllib2 import URLError
from getch import getch, pause
import numpy as np
websocket.enableTrace(True)
ws = websocket.create_connection("ws://169.254.7.144:1234") 

When I run this program I am getting the error

File "on_laptop.py", line 35, in

websocket.enableTrace(True)

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

like image 986
Dhepak Somu Avatar asked Jun 04 '26 01:06

Dhepak Somu


1 Answers

You've probably installed the websocket package (which doesn't have an enableTrace method) instead of websocket-client.

pip install websocket-client should solve your problem.

like image 81
Escher Avatar answered Jun 08 '26 00:06

Escher