Archive
How to debug your OpenERP modules
Debugging your OpenERP modules is quite straightforward, as long as you know basic Python programming. Just insert the following line in your
module:
import pdb;pdb.set_trace()
Then restart your openerp-server with the –debug option
# openerp-server –debug
Then monitor your server console. You will see your server stop and show you a command line prompt where you will be able to debug your program.
You will find further information in the Python documentation website.
Related articles
- Alan Bell: ERPpeek, a tool for browsing OpenERP data from the command line (theopensourcerer.com)
Managing your openerp processes with Supervisor
Reading a book on system administration with Python I found Supervisor, which is a tool that allows you manage your programs. I found it easy to
install and learn, and in minutes I had it running in my system. After reading the documentation, which took me minutes, I was able to configure its configuration file, restart the daemon and have openerp-server and openerp-web running automatically in my computer.
Below is am example of how to modify the supervisord.conf file in order to start openerp-server and openerp-web
[program:openerp-server]
command=/usr/local/bin/openerp-server
user=gustavo[program:openerp-web]
command=/usr/local/bin/openerp-web
Why I like it? Because this tool allows me to manage my process and it does not take me long to do that. It can also be controlled by other Python programs, which might be handy in some projects.
openerp-server 5.0 and Python 2.7
After upgrading Ubuntu to 11.04 I found the nasty surprise that openerp-server 5.0 could not create a new database because it threw the following error message:
ValueError: opcode JUMP_IF_FALSE_OR_POP not allowed (u’auto_picking and test_auto_picking()’)
After doing some quick research with Google, I found the following bug that is already fixed in openerp-server v6:
https://bugs.launchpad.net/openobject-server/+bug/673773
Since upgrading to openerp v6 at this time is not an option for me, I only needed to make a slight change to make openerp-server work with Python 2.6. I already had python 2.6 installed in my Ubuntu system, which I could check with the following command:
gustavo@gustavo-laptop:/usr/bin$ python2.6
Python 2.6.6 (r266:84292, Mar 25 2011, 19:36:32)
[GCC 4.5.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>>
Then I changed the openerp-server command at my /usr/local/bin directory. I only needed to change the
exec /usr/bin/python ./openerp-server.py $@
line to
exec /usr/bin/python2.6 ./openerp-server.py $@
And that is all I needed to do to get my system back to work
Related Articles
- New release of OpenERP All-in-one installer & updater for Ubuntu (openerpappliance.com)
- How to Install OpenERP v6 on Ubuntu server 10.10 (adilmukarram.wordpress.com)
