Python twisted manhole,类似于ipython的功能
我在网上找到的这个代码运行起来了
#manhole
from twisted.internet import reactor
from twisted.manhole import telnet
def createShellServer( ):
print 'Creating shell server instance'
factory = telnet.ShellFactory()
port = reactor.listenTCP( 2000, factory)
factory.namespace['x'] = application
factory.namespace['s'] = s
factory.username = 'me'
factory.password = 'me'
print 'Listening on port 2000'
return port
这个方法有效,我成功地进入了我那个复杂的应用程序。但是我不能用上箭头键查看之前的命令,也没有自动补全的功能。我觉得能查看历史命令会对我很有帮助。
这些对我来说都是很新的东西。所以我觉得我可能在用一种旧的方法来进入系统。任何帮助都非常感谢。
1 个回答
1
你正在使用一个旧的、已经不再维护的 manhole 实现。
相反,你应该使用 Twisted Conch 中包含的那个。你可以在这里找到它的使用示例,以及 其他 Twisted Conch 的示例。