Python,扭曲的代码在这个函数的中间返回

时间:2016-03-06 10:28:50

标签: python json twisted

我正在开发一个使用Twisted的项目,我正在尝试调试我的代码,它只是在函数中间返回而没有错误。

这是函数

def printData(self, response, client_id, limit):
    json_data = json.loads(response)
    results = json_data["results"]
    # Limit results
    json_data["results"] = results[0:int(limit)]
    logging.info("API Response: {0}".format(json.dumps(json_data, indent=4)))
    msg = self.factory.clients[client_id]["msg"]
    full_response = "{0}\n{1}\n\n".format(msg, json.dumps(json_data, indent=4))
    self.transport.write(full_response)

响应是一个json文本,客户端ID类似于wikip.cs.info.com,限制为20。

该功能在第二行之后不执行,并且不显示任何错误。知道为什么会这样吗?

0 个答案:

没有答案