compiling binary.py file after modification

Asked by Bushair

Hello
Can anyone tell me

1)after modifying the file bin/widget/view/form_gtk/binary.py with a change for testing , how can i compile this file?

2)From which location i have to do the compilation ?

thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Borja López Soilán (NeoPolus) (borjals) said :
#1

Python code does not really require compiling. The ".pyc" files you see are just 'optimized' versions of the ".py" files (comments, spaces, etc. are removed so the files are much more compact), they are not machine language objects (like in C) but similar to bytecode objects (like in Java).
Python generates them on the fly the first time the file is loaded, just to speed up subsequent loads; that is, they just speed up the loading. If Python can not generate the ".pyc" file (for example your ".py" file is on a read-only disc) then he will just use the ".py" file.

If you modify the ".py" file (it's modification date is greater than the ".pyc" file), Python will recompile it on the fly and write a new ".pyc" file.

Note: There is an -o flag for Python, and even a -oo, that optimizes the bytecode (and writes a ".pyo" file instead of a ".pyc"), but the truth is that just removes assertions (so is not really faster...) or assertions and document comments (more compact files, but that's all).

Revision history for this message
Bushair (bushairka) said :
#2

Hello,
Thanks for the answer.
But it is not working for me as you explained.

I have modified the file binary.py located in /opt/openerp-client/bin/widget/view/form_gtk/binary.py
and removed the .pyc file located in this location.

The modification i have do in this file is that i added a new button called Scan and renamed the Save As button to 'Save like'.

After this i have restarted the openerp server and i coulndt see the new .pyc file generated for this.
Also the changes are not there in the screen.

Why is it so?

thanks

Revision history for this message
Bushair (bushairka) said :
#3

Hello hda,
Can you please tell me how

1)after modifying the file bin/widget/view/form_gtk/binary.py with a change for testing , how can i compile this file?

2)From which location i have to do the compilation ?

thanks

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#4

Hello Bushair,

You need to restart the client not the server.

Thanks.

Can you help with this problem?

Provide an answer of your own, or ask Bushair for more information if necessary.

To post a message you must log in.