← Back to team overview

openerp-community team mailing list archive

Re: 2 questions regarding development in OpenERP

 

On 14/03/2012 03:58, zaki1029 wrote:
> Hi Team,

Hello zaki1029,

> First of all, I'm more than happy to join this family.
> Actually, during the development in OpenERP, I have come across 2
> problems these days.
>
> 1. I'm using a 3rd party IDE like Eclipse or Pycharm to import the whole
> OpenERP folder. After that, I tried to run some files like
> project/project.py. But it will end up with the error like "no module
> named tools.translate". Does this mean I only need to import the add-on
> folder into IDE? But if I do it in that way, it will pop up the error
> like "no module named openerp".
> Is there any best practice brought up so far that could make the
> compilation of py files in Openerp more smoothly?

You need to configure the PYTHONPATH in your IDE to list top level modules.

> 2. I noticed that in every module, there will be a pyo file matching to
> a py file. But even if I delete the pyo file and restart the openerp
> service, it will never generate again. It will only be regenerated when
> we modify the py file and restart the service.
> I have read the code in setup.py and it only has the code
> " if not re.match(r'.*(\.pyc|\.pyo|\~)$',filename):
>                 files.append(os.path.join(root, filename))"
> which means if no pyo append, add the pyo file.
> So my question is what's the mechanism in openerp against the generating
> of pyo file. And is there any way that we could generate the pyo file
> instead of restarting the openerp service?
>
> Thanks a lot for attention in advance.
>


Don't bother with .pyo and .pyc files, and let Python manage them as it
want. The only time when generating them manually is required is when
the .py file lives in a directory in which the user running the code
does not have write access.

-- 
Alexandre Fayolle
Chef de Projet
Tel : + 33 (0)4 79 26 57 92

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
http://www.camptocamp.com



References