Technical 보관된 메일 그룹


Re: PyPy (it work's !)

- 2017년 05월 05일 11시 17분 42초
today, have testing odoo10 on pypy-5.1, all are ok, but qweb raise error

    return self.env[engine].render(, qcontext)
  File "/opt/odoo/odoo-10/odoo/addons/base/ir/ir_qweb/", line 53, in render
    return super(IrQWeb, self).render(id_or_xml_id, values=values, **context)
  File "/opt/odoo/odoo-10/odoo/addons/base/ir/ir_qweb/", line 248, in render
    self.compile(template, options)(self, body.append, values or {})
  File "/opt/odoo/odoo-10/odoo/addons/base/ir/ir_qweb/", line 322, in _compiled_fn
    raise QWebException("Error to render compiling AST", e, path, node and etree.tostring(node[0]), name)
QWebException: keywords must be strings
Traceback (most recent call last):
  File "/opt/odoo/odoo-10/odoo/addons/base/ir/ir_qweb/", line 315, in _compiled_fn
    return compiled(self, append, values, options, log)
  File "<template>", line 1, in template_285_54
  File "<template>", line 3, in body_call_content_53
  File "/opt/odoo/odoo-10/odoo/addons/base/ir/ir_qweb/", line 313, in _compiled_fn
    values = dict(self.default_values(), **values)
TypeError: keywords must be strings

Error to render compiling AST
TypeError: keywords must be strings
Template: 285
Path: /templates/t/t/div/t/t
Node: <t t-call="website.http_error_debug"/>

On 11 April 2016 at 03:42, Nicolas PIGANEAU <> wrote:
Hi Jeffery,

You need the cffi version of lxml from (cffi branch). I had segfaults with the standard CPython version.

Also I never managed to create a database with PyPy (it was partly empty), but managed to use an existing database with the tricks given below.



NDP Systèmes
06 68 93 87 56

De: "Jeffery" <>
À: "Community: Framework" <>
Envoyé: Dimanche 10 Avril 2016 11:32:32
Objet: Re: PyPy (it work's !)

recently i try to run odoo8 on pypy 5.0.1, it failed and report  segmentation fault.

install ubuntu 14.0.4 LTS , then install postgresql database and git tools. update odoo 8.0 source code from and save code in /opt/odoo/ . download pypy-5.0.1 for Linux 64, and extract it to /opt/pypy/. download save into /tmp/, and change to /opt/pypy/bin, then run ./pypy /tmp/ to install pip tool.

because some python lib need to compile from source, so need to install dev tools, and run command sudo apt-get install libxml2 libxslt-dev libpq-dev libldap2-dev libsasl2-dev

change /opt/odoo/requirements.txt as change psycopg2 to psycopg2cffi and add new line as psycopg2cffi-compact, then install python lib via sudo /opt/pypy/bin/pip install -r /opt/odoo/requirements.txt.

now, pypy for odoo is reday. next, should to create database for odoo, and run odoo daemon.

use command sudo -u postgres createuser --createdb --no-createrole --no-superuser --pwprompt odoo to create postgres user odoo and assign a password, such like 1234. now edit odoo.conf file and save in /opt/odoo/, the content of odoo.conf is

; This is the password that allows database operations:
; admin_passwd = admin
db_host =
db_port = 5432
db_user = odoo
db_password = 1234

change to odoo directory, use command /opt/pypy/bin/pypy -c odoo.conf to start the odoo service.


if lxml-3.3.5 is not working, please upgrade it to lxml-3.6.

if odoo raise opcocde LOOKUP_METHOD is not allowed and/or opcocde CALL_METHOD is not allowed, please edit /opt/odoo/openerp/tools/ to add those two opcode into var _SAFE_OPCODES

_SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [
    # New in Python 2.7 - :
    'LOAD_GLOBAL', 'LOOKUP_METHOD','CALL_METHOD',# Only allows access to restricted globals
    ] if x in opmap))

type url as http://ip_address_of_odoo_box:8069 to openerp odoo application, create a new database with demonstration data.

login odoo, and click inbox, odoo should crash because segmentation fault.

any feedback should be thankful.


On Mon, Jun 1, 2015 at 8:03 AM, Nicolas PIGANEAU <> wrote:
Thank you for your answers, Raphaël and Ruben.

I've got further today, and managed to have my first Odoo server on PyPy running ! 
But there is still some way to go. 

As I said before, I came across 2 issues: 

1. Database creation does not work. After having rapidly inspected the generated database, only the base module has been loaded, although the logs show that all the modules have been loaded. I suppose that there has been a rollback somewhere, but I'll have to check. 

2. When using an already created database, I had issues with inherited views, as you mentioned. With the fact that only one every other line of the inherited view was inserted inside the base view, I managed to locate the issue, and applying the following patch solves it:

--- openerp/addons/base/ir/	(revision e9f802425cf8ca0f82e7075774585d4ca897ad08)
+++ openerp/addons/base/ir/	(revision )
@@ -449,7 +449,7 @@
                     if node.getparent() is None:
                         source = copy.deepcopy(spec[0])
-                        for child in spec:
+                        for child in spec[:]:
                 elif pos == 'attributes':
@@ -461,7 +461,7 @@
                             del node.attrib[attribute[0]]
                     sib = node.getnext()
-                    for child in spec:
+                    for child in spec[:]:
                         if pos == 'inside':
                         elif pos == 'after':

Maybe there are other places in the Odoo code where the same sort of modifications should be made, but this was enough to get it running. 
For the few quick tests I made, I get QWebException complaining about void* not being known and giving a code 500. But if you reload several times, you get it running in the end. And when you get the interface, then no more problems.

Now, for the big question: is it really faster than Odoo in CPython ?
Well, I did not have time to make a lot of benchmarking, but:
- The interface seems the same speed as the CPython version, I'll have to make deeper tests to see if the server calls are faster or not.
- On one specific stock operation (validating a several hundred lines picking) which took me just above 1 minute on CPython server took only 27 seconds on the PyPy server.
=> So it seems to be significantly faster (~x2), at least on operations with a lot of python calculation like stock operations. Now it needs to be confirmed with full benchmark.


NDP Systèmes
06 68 93 87 56

----- Mail original ----- 
De: "Raphaël Valyi" <> 
À: "Community: Framework" <> 
Envoyé: Samedi 30 Mai 2015 15:02:09 
Objet: Re: PyPy 

Hello Nicolas, 

a few months ago I tried again and commented here 

Basically it seems the Pypy lxml implementation differs from the CPython one and eventually this is what breaks the view inheritance system. Also I pioneered tests on Jython back around 2011 and I had the same issues with the Java based lxml adapter not having the exact same internals of the one of CPython. May be it's not this issue anymore but I bet it is. That's interesting to see efforts here however. Let us know if you make any progress on this. 


On Fri, May 29, 2015 at 9:00 PM, Nicolas PIGANEAU < > wrote: 


Has anyone tried to run Odoo on PyPy recently ? 

On my side, I used: 
- lxml-cffi from git:// - latest gevent sources (after merging ) 
- psycopg2cffi and psycopg2cffi-compat (pip install)

I had also to patch Odoo sources to add pypy opcodes to safe_eval: 

--- ../GitHub/odoo/openerp/tools/	(date 1432802291000)
+++ ../GitHub/odoo/openerp/tools/	(date 1432901508000)
@@ -69,6 +69,7 @@
 _SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [

And also add this one if I wanted to start in multi-worker mode (for some reason pypy complained they were float instead of int): 

--- ../GitHub/odoo/openerp/service/	(date 1432802291000)
+++ ../GitHub/odoo/openerp/service/	(date 1432901508000)
@@ -713,7 +713,7 @@
             raise Exception('CPU time limit exceeded.')
         signal.signal(signal.SIGXCPU, time_expired)
         soft, hard = resource.getrlimit(resource.RLIMIT_CPU)
-        resource.setrlimit(resource.RLIMIT_CPU, (cpu_time + config['limit_time_cpu'], hard))
+        resource.setrlimit(resource.RLIMIT_CPU, (int(cpu_time + config['limit_time_cpu']), hard))
     def process_work(self):

Then my server starts all right and I am able to go to the database manager page.
Creating a database seems to work, but it is then impossible to load the created database. Indeed, it seems some imports have been skipped.
In particular, ir_model_data is only filled with xml_ids of the base module.

So I created a database from a cpython instance and accessed it through my pypy instance. I could login, but then the loading stopped after 
displaying the top menu. A look in firebug showed that JS complained about "nv" not being defined in graph_widget.js. 

So I checked what had been loaded, and found out that only one every other scripts had been loaded from this module, but also from all 
other modules. Same goes for css files: one loaded, one skipped, one loaded, etc. for each line of the assets_backend extension template 
(web_graph/views/web_graph.xml in this case).

I suppose this an issue linked with lxml, that sort of misses one line every two lines but I haven't got a clue on where to go now. 

Any idea or experience on this?

Thanks !


NDP Systèmes
06 68 93 87 56 

Post to: mailto: 

Raphaël Valyi 
Founder and consultant 
+55 21 3942-2434 

Post to: 

Post to:

Jeffery        -odoo expert form kunshan, suzhou, china

Post to:

Post to:

Jeffery        -odoo expert form kunshan, suzhou, china 
IM Q913547235