Chameleon Template cook() function (using PyCharm/Pyramid)

时间:2015-08-07 02:33:57

标签: python pycharm pyramid chameleon

In Chameleon's template.py file there's a cook(self, body) function and the problem I have occurs during executing this line:

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

And this will lead to _cook(self, body, digest, buildins) function and the line

source = self._make(body, buildins)

I am using PyCharm and I have two python2.7 interpreters. They both work if I just run the pyramid program. And they both can connect to pydev debugger when run in debug mode. 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

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.

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. I know the different behaviors are caused by two different python 2.7 interpreters. But I really don't know how to dig further. So, any help or advice is very much appreciated.

1 个答案:

答案 0 :(得分:0)

我想我已经等了足够长时间来讨论这个问题了。所以我决定继续写一些方法来解决这个问题。 虽然这个问题以“变色龙”这个词开头,但我认为这只是一个“症状”。不是因为'。原因再次出现在您的环境中。 所以我所做的只是创建另一个env并使用另一个解释器。这里的关键是使用命令行运行setup.py(develop),而不是从pycharm运行setup.py。我找到了一些相关的问题,并尝试了一些方法。其中一人曾帮助过一次,但并不总是有效。以下是链接。 Pydev Debugger