简体   繁体   English

配置Pycharm来调试Odoo 8

[英]configure Pycharm to debug Odoo 8

i've installed pycharm community edition 2016. 我已经安装了pycharm社区版2016。

I tried to configure it to debug Odoo as illustrated in the capture 我尝试将其配置为调试Odoo,如捕获中所示

在此输入图像描述

When i open a python file set a breakpoint and click debug icon i got an exception: 当我打开python文件设置断点并单击调试图标时,我得到一个例外:

在此输入图像描述

Also openerp, fields, api are underlined in red. 还有openerp,fields,api用红色加下划线。

Any suggestions please. 请给我任何建议。 I use windows 8.1 as OS 我使用Windows 8.1作为操作系统

Update : 更新

According to Mariusz Answer , i'm now able to clic on debug bouton without any error. 根据Mariusz答案,我现在能够在没有任何错误的情况下调试bouton。

Now i have put a brekpoint on a code to follow the execution, but the breakpoint is never reached ( the code is inside a buton method) while the method is executed. 现在我已经在代码上放了一个brekpoint来跟随执行,但是在执行方法时,从未达到断点(代码在buton方法内)。 I can see the result in odoo page. 我可以在odoo页面看到结果。

在此输入图像描述

First question - you are not supposed to run it from exe file, but from openerp-server, which is located in odoo installation folder via python interpreter. 第一个问题 - 你不应该从exe文件运行它,而是从openerp-server运行它,它通过python解释器位于odoo安装文件夹中。 What is more, your configuration is wrong, because Odoo does not work with Python 3.4.1 My configuration looks like this: 更重要的是,你的配置是错误的,因为Odoo不适用于Python 3.4.1我的配置如下所示: 在此输入图像描述 Second question - you need to add your sources folder in Project Structure configuration so it is recognized by PyCharm as a folder from which to import. 第二个问题 - 您需要在项目结构配置中添加源文件夹,以便PyCharm将其识别为要从中导入的文件夹。

To be able to reach breakpoint you have to disable gevent. 为了能够达到断点,你必须禁用gevent。 At the moment of writing you can do it by commenting this piece of code in openerp/__init__.py 在撰写本文时,您可以通过在openerp / __ init__.py中注释这段代码来实现

import sys
evented = False
#if sys.modules.get("gevent") is not None:
#    evented = True

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

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