当我尝试运行以下代码时...
from telnetsrvlib import *
if __name__ == '__main__':
"Testing - Accept a single connection"
class TNS(SocketServer.TCPServer):
allow_reuse_address = True
class TNH(TelnetHandler):
def cmdECHO(self, params):
""" [<arg> ...]
Echo parameters
Echo command line parameters back to user, one per line.
"""
self.writeline("Parameters:")
for item in params:
self.writeline("\t%s" % item)
def cmdTIME(self, params):
"""
Print Time
Added by dilbert
"""
self.writeline(time.ctime())
logging.getLogger('').setLevel(logging.DEBUG)
tns = TNS(("0.0.0.0", 8023), TNH)
tns.serve_forever()
我收到这个错误
Traceback (most recent call last):
File ".\telserv.py", line 1, in <module>
from telnetsrvlib import *
File "C:\Python27\lib\site-packages\telnetsrvlib-1.0.2-py2.4.egg\telnetsrvlib.py", line 31, in <module>
import curses.ascii
File "C:\Python27\lib\curses\__init__.py", line 15, in <module>
from _curses import *
我正在运行 python 2.7 并导入了 telnetsrvlib 库,我正在 Windows 7 上运行代码。任何帮助将不胜感激。