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.
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.
How can i achieve this with OpenERP 6.1??
Please help!! Thanks in advance..
I run the 6.1 server under Eclipse and PyDev without any problems. That lets me add breakpoints and step through the code. Here are the arguments I use:
The two breakpoints I find most useful are at either end of the RPC call. On the server side, I put a breakpoint on this line in
netsvc.dispatch_rpc()
:I don't debug the client as often, and not all requests come through the same path, but one useful breakpoint is the first line of
rpc.tinySocket_gw.execute()
.Of course, both these breakpoints see a lot of traffic, so I only use them if I'm exploring some feature I'm not familiar with, and I don't know where the code will execute. It can also be useful to put a condition on the breakpoint so it only triggers when a request comes through for a specific model or parameter value.
Here is the config file I use:
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".
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.
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.
First:
import logging
Then :
And in your openerp folder
/server/server/openerp-server.log
file you will see thelog.info
content here ( ExampleClass -- ExampleFunction: test)Hi friend you can install ipython. Using ipython you can debug openerp 6.1 at command prompt. kindly make sure that you have installed these packages before hands.
I took this list from http://www.theopensourcerer.com/2012/02/22/how-to-install-openerp-6-1-on-ubuntu-10-04-lts/
you can also try pycharm.
Check that you have:
in your openerp-server.conf, that gives you the log through the standard output.
Does it helps ?