如何在OpenERP 6.1中调试python代码 [英] How to debug python code in OpenERP 6.1

查看:75
本文介绍了如何在OpenERP 6.1中调试python代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用OpenERP 6.1,但无法调试python代码 通过在python代码中提供打印语句.

I am working with OpenERP 6.1 and i am not able to debug the python code by giving print statements in the python code.

这在OpenERP 6.0中非常容易/可行,我们在其中提供了服务器路径 紧随其后的是模块名称和数据库名称以调试代码.

This was quite easy/possible with OpenERP 6.0 where we give the server path followed by module name and database name to debug the code.

如何使用OpenERP 6.1实现此目标?

How can i achieve this with OpenERP 6.1??

请帮助!! 预先感谢..

Please help!! Thanks in advance..

推荐答案

要在eclipse中调试您的Openerp + python代码,请在debug透视图中启动eclipse并按照给定的步骤进行操作:

To debug your Openerp+python code in eclipse, start eclipse in debug perspective and follow the given steps:

1:按下"ctr + c",停止运行openERP的服务器.

1: Stop your openERP running server by pressing "ctr+c".

2:在eclipse中,转到菜单运行/调试配置".在"Python Run"下的配置窗口中,创建新的调试配置(双击"Python Run").

2: In eclipse go to Menu "Run/Debug Configurations". In configuration window under "Python Run", create new debug configuration(Double click on 'Python Run').

3:创建新的调试配置后,请执行以下步骤:

3: After creating new debug configuration follow the given steps:

3.1:在项目"下的主"选项卡中,从工作区中选择服务器"项目或文件夹(Openerp Server所在的文件夹).

3.1: In "Main" tab under "Project", select the "server" project or folder (in which Openerp Server resides) from your workspace.

3.2:在主模块"下写入"openerp-server"的位置.

3.2: Write location of 'openerp-server' under "Main Module".

例如:$ {workspace_loc:server/openerp-server}.

Ex: ${workspace_loc:server/openerp-server}.

3.3:在程序参数"下的参数"选项卡中,单击变量"按钮,将出现新窗口.

3.3: In "Arguments" tab under "Program Arguments", click on button "Variables" and new window will appear.

3.4:然后通过单击编辑变量"按钮创建新的变量",然后将出现新窗口.

3.4: Then create new "Variable" by clicking on "Edit Variables" button and new window will appear.

3.5:按下新建"按钮,并为您的插件路径指定值.

3.5: Press on "New" button and give your addons path as value.

例如:--addons ../addons,../your_module_path

Ex: --addons ../addons,../your_module_path

3.6:在所有打开的窗口中按确定",然后单击应用".

3.6: Press Ok in all the opened windows and then "Apply".

4:现在进入"PyDev包资源管理器"视图,转到6.1/server,然后右键单击"openerp-server"文件,选择"Debug As-> Python Run".

4: Now into "PyDev Package Explorer" view go to 6.1/server and right click on "openerp-server" file, Select 'Debug As --> Python Run'.

5:现在在控制台"中,您可以看到服务器已启动.

5: Now in "Console" you can see your server has been started.

6:现在打开要调试的.py文件并设置断点.

6: Now open your .py file which you want to debug and set a break-point.

7:现在从"gtk"或"web-client"启动模块的表单,当执行到断点时,执行将停止.

7: Now start your module's form from 'gtk' or 'web-client' and execution will stop when execution will reach to break-point.

8:现在,通过按"F5,F6,F7"调试代码,您可以看到变量的值.

8: Now enjoy by debugging your code by pressing "F5, F6, F7" and you can see value of your variables.

这篇关于如何在OpenERP 6.1中调试python代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆