简体   繁体   English

变色龙模板cook()函数(使用PyCharm /金字塔)

[英]Chameleon Template cook() function (using PyCharm/Pyramid)

In Chameleon's template.py file there's a cook(self, body) function and the problem I have occurs during executing this line: 在Chameleon的template.py文件中,有一个cook(self, body)函数,执行此行时出现了我遇到的问题:

program = self._cook(body, digest, names)

And this will lead to _cook(self, body, digest, buildins) function and the line 这将导致_cook(self, body, digest, buildins)函数和该行

source = self._make(body, buildins)

I am using PyCharm and I have two python2.7 interpreters. 我正在使用PyCharm,并且我有两个python2.7解释器。 They both work if I just run the pyramid program. 如果我只运行金字塔程序,它们都可以工作。 And they both can connect to pydev debugger when run in debug mode. 在调试模式下运行时,它们都可以连接到pydev调试器。 However, one of them ('bad' interpreter) will have the following error when handling a request in debug mode. 但是,其中一个(“错误的”解释器)在调试模式下处理请求时将出现以下错误。

ImportError: cannot import name pydev_debugger_exc_info

I tried to dig further and I found that when I use the 'good' interpreter, my template .pt file will be cooked into a .py temp file/object (source) with the starting line as 我尝试进一步挖掘,发现使用'good'解释器时,我的模板.pt文件将被烹饪成.py临时文件/对象(源),其起始行为

from sys import exc_info as _exc_info

which will work just fine. 这将很好地工作。 While the 'bad' interpreter will end up with the following as the first line. 虽然“ bad”解释器将以第一行结尾。

from _pydev_imps._pydev_sys_patch import pydev_debugger_exc_info as _pydev_debugger_exc_info

I have also tried to use other versions of pramid/chameleon etc but ended up having the same problem. 我也曾尝试使用其他版本的pramid / chameleon等,但最终遇到了同样的问题。 I know the different behaviors are caused by two different python 2.7 interpreters. 我知道不同的行为是由两个不同的python 2.7解释器引起的。 But I really don't know how to dig further. 但是我真的不知道该如何进一步挖掘。 So, any help or advice is very much appreciated. 因此,非常感谢任何帮助或建议。

I think I have waited long enough for this question. 我想我已经等了很长时间了。 So I decided to go ahead and write some methods to walk around this issue. 因此,我决定继续写一些方法来解决这个问题。 Though this question starts with word 'Chameleon', I think this is only the 'symptom' not the 'cause'. 尽管这个问题以“变色龙”一词开头,但我认为这只是“症状”,而不是“原因”。 The cause, again, is within your environment. 原因再次出在您的环境中。 So what I did is just to create another env and use another interpreter. 所以我所做的只是创建另一个环境并使用另一个解释器。 The key here is to run setup.py (develop) using your command lines instead of running setup.py from pycharm. 此处的关键是使用命令行运行setup.py(开发),而不是从pycharm运行setup.py。 I have found some related issues, and tried some of the methods. 我发现了一些相关问题,并尝试了一些方法。 One of them helped for once but didn't always work. 其中一个曾提供过一次帮助,但并不总是奏效。 Following is the link. 以下是链接。 Pydev Debugger Pydev调试器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM