I want to use the cmd
Python library, which provides an interactive shell to the tcp server, but it does not work properly. The application will have more than one infinite loop one for the server called serve_forever
and one for the shell called cmdloop
. The code looks like this:
class MyServer(TCPServer, Cmd):
def __init__(self, host, port)
TCPServer.__init__(self, (host, port), RequestHandler)
app = MyServer()
app.cmdloop()
app.serve_forever()
This also results in an error:
if self.use_rawinput and self.completekey:
AttributeError: 'MyServer' object has no attribute 'completekey'. Did you mean: 'complete'?
I also tried out cmd2
and it too returns an error
ine 5262, in cmdloop
self.terminal_lock.acquire()
AttributeError: 'Server' object has no attribute 'terminal_lock'