Search code examples
pythonshellpathodoo-8odoo

How to get into the python shell within Odoo 8 environment?


I would like to use the Odoo Framework from the shell.

I installed the module "Shell command backport" (technical name: shell), but I couldn't make it work.

$ ./odoo.py shell --addons-path=/opt/odoo_8/src/linked-addons -d database_name
Traceback (most recent call last):
  File "./odoo.py", line 160, in <module>
    main()
  File "./odoo.py", line 157, in main
    openerp.cli.main()
  File "/opt/odoo_8/src/OCA/OCB/openerp/cli/__init__.py", line 58, in main
    for m in module.get_modules():
  File "/opt/odoo_8/src/OCA/OCB/openerp/modules/module.py", line 351, in get_modules
    plist.extend(listdir(ad))
  File "/opt/odoo_8/src/OCA/OCB/openerp/modules/module.py", line 346, in listdir
    return map(clean, filter(is_really_module, os.listdir(dir)))
OSError: [Errno 2] No such file or directory: '/opt/odoo8/openerp/addons'

Where is defined the path /opt/odoo8/openerp/addons? I checked this similar question as well.

If I don't write the addons path in the command the error appears again.

I read the answer of this other question, I tried the module and the script option but they didn't work. What should I do to make it work? Any hint would help.


Solution

  • Check your .opererp_serverrc for the user you are executing the command as. In the users home directory you will find this file. There may be reference to the addons_path. The path it appears to be looking for /opt/odoo8/openerp/addons differs from what you have specified in your command. I would check your config files.