how can i debug openerp code in to the eclipse [closed]

可紊 提交于 2019-12-04 04:48:15

问题


how can I debug python code in to the eclipse.if it will be done then we face less effort and fast do our work.can any one tell me???


回答1:


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

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

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: After creating new debug configuration follow the given steps:

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

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

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

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

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

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

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

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

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: Now in "Console" you can see your server has been started.

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

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

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




回答2:


Step 1: You have to maintain in Eclipse the location of your Python installation. Open in the menu Window -> Preference and select Pydev-> Interpreter Python. Python path will be automatically loaded by default, if not click on new to add and maintain python package.

Step 2: Now create a new project and paste your openerp source code here in the project.Select File -> New -> Project. Select Pydev -> Pydev Project. You can also select General -> Project

Step 3: Select Window->Open Perspective ->Other. Select the PyDev perspective.

Step 4: Now open your project -> openerp_server_folder, find the openerp_server.py file which is used to run the server. Right-click on the python file select Run As -> Python Run for debugging you can use Debug As ->Python Run. Now you will be able to run the server from eclipse.You can see it in the eclipse console

For debugging, open your python file in eclipse, right click on the margin then click on 'Add breakpoint'. Then you two tabs will be opened, one named Debug and Variables and Breakpoint. From this we can see all the variables and its values,and thus we can debug our code.

Reference:http://www.vogella.com/articles/Python/article.html



来源:https://stackoverflow.com/questions/12298811/how-can-i-debug-openerp-code-in-to-the-eclipse

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!