下面给出了服务器的代码:
from twisted.internet import protocol
from twisted.internet import reactor
class Echo(protocol.Protocol):
def dataRecvd(self, data):
self.transport.write(data)
class EchoFactory(protocol.Factory):
def buildProtocol(self, addr):
return Echo()
reactor.listenTCP(8000,EchoFactory())
reactor.run()我得到以下错误:
listenTCP()- Undefined variable from import
run- Undefined variable from import我在windows7上使用pydev和eclipse。我哪里错了?
发布于 2014-02-19 15:12:09

尝试添加#@UndefinedVariable,如下所示:
reactor.listenTCP(8000,EchoFactory()) #@UndefinedVariable
reactor.run() #@UndefinedVariable发布于 2014-02-19 20:01:09
listenTCP()-来自导入的未定义变量
这不是Python异常。我猜这是pylint这样的工具造成的“错误”。这是假的。这没有任何意义。
我也在外壳上试过了,程序开始执行,然后什么也没有执行。没有输出。
你知道程序应该做什么吗?它不应该在shell中产生任何输出。
https://stackoverflow.com/questions/21872499
复制相似问题