简体   繁体   中英

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:

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.

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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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