我想在PyCharm中调试一个扭曲的应用程序
from twisted.internet import defer
from twisted.application import service, internet
from txjason.netstring import JSONRPCServerFactory
from txjason import handler
class Example(handler.Handler):
def __init__(self, who):
self.who = who
@handler.exportRPC("add")
@defer.inlineCallbacks
def _add(self, x, y):
yield
defer.returnValue(x+y)
@handler.exportRPC()
def whoami(self):
return self.who
factory = JSONRPCServerFactory()
factory.addHandler(Example('foo'), namespace='bar')
application = service.Application("Example JSON-RPC Server")
jsonrpcServer = internet.TCPServer(7080, factory)
jsonrpcServer.setServiceParent(application)我知道如何从命令行运行应用程序,但是如何在PyCharm中开始调试却不理解
发布于 2015-10-06 18:15:52
在PyCharm中的"Python“部分下创建一个新的PyCharm。
如果您使用twistd启动此应用程序,那么将"Script“设置配置为指向该扭曲,并将”脚本参数“配置为命令行中的”脚本参数“。您可能希望包括--nodaemon选项。
然后,您应该能够在PyCharm或设置断点下运行它并调试它。
https://stackoverflow.com/questions/32970894
复制相似问题