gpt4 book ai didi

python-2.7 - 我收到属性错误 : 'module' object has no attribute 'enableTrace' while running a python code

转载 作者:行者123 更新时间:2023-12-04 13:26:25 26 4
gpt4 key购买 nike

我正在使用 python 2.7 并且我已经安装了模块 websocket-client 0.40.0 但是我收到了我上面提到的属性错误。

这是我的代码,我正在尝试通过 websocket 将我的 PC 连接到微 Controller 板

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")

当我运行这个程序时,我收到错误

文件“on_laptop.py”,第 35 行,在
websocket.enableTrace(True)

AttributeError: 'module' 对象没有属性 'enableTrace'

最佳答案

您可能已经安装了 websocket包(没有 enableTrace 方法)而不是 websocket-client .
pip install websocket-client应该可以解决您的问题。

关于python-2.7 - 我收到属性错误 : 'module' object has no attribute 'enableTrace' while running a python code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42905748/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com