Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to fix "TypeError: expected string or buffer" leading to internal server error?

Peter Horn
on 9/30/14, 10:12 AM 3,176 views

I set up Ubuntu 14.04 Trusty Tahr (64 Bit) today and attempted to set up an Odoo development environment as described in the readme file (`wget -O- https://raw.githubusercontent.com/odoo/odoo/master/odoo.py | python`).

When I start the Odoo server  by executing `./openerp-server` in the terminal, the HTTP listens on local host on port 8069. When I try to access the web interface with Chromium or Firefox, a redirect to http://localhost:8069/web is performed which causes an internal server error: a 500 page displayed in the browser and this written in the console:

2014-09-30 14:09:25,164 8348 INFO None werkzeug: - - [30/Sep/2014 14:09:25] "GET /favicon.ico HTTP/1.1" 404 -
2014-09-30 14:09:35,738 8348 INFO None werkzeug: - - [30/Sep/2014 14:09:35] "GET / HTTP/1.1" 200 -
2014-09-30 14:09:35,756 8348 INFO None werkzeug: - - [30/Sep/2014 14:09:35] "GET /web HTTP/1.1" 500 -
2014-09-30 14:09:35,770 8348 ERROR None werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/home/peter/odoo/openerp/service/server.py", line 234, in app
    return self.app(e, s)
  File "/home/peter/odoo/openerp/service/wsgi_server.py", line 216, in application
    return application_unproxied(environ, start_response)
  File "/home/peter/odoo/openerp/service/wsgi_server.py", line 202, in application_unproxied
    result = handler(environ, start_response)
  File "/home/peter/odoo/openerp/http.py", line 1211, in __call__
    return self.dispatch(environ, start_response)
  File "/home/peter/odoo/openerp/http.py", line 1185, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 579, in __call__
    return self.app(environ, start_response)
  File "/home/peter/odoo/openerp/http.py", line 1355, in dispatch
    result = _dispatch_nodb()
  File "/home/peter/odoo/openerp/http.py", line 1334, in _dispatch_nodb
    result = request.dispatch()
  File "/home/peter/odoo/openerp/http.py", line 610, in dispatch
    r = self._call_function(**self.params)
  File "/home/peter/odoo/openerp/http.py", line 280, in _call_function
    return self.endpoint(*args, **kwargs)
  File "/home/peter/odoo/openerp/http.py", line 729, in __call__
    return self.method(*args, **kw)
  File "/home/peter/odoo/openerp/http.py", line 372, in response_wrap
    response = f(*args, **kw)
  File "/home/peter/odoo/addons/web/controllers/main.py", line 468, in web_client
  File "/home/peter/odoo/addons/web/controllers/main.py", line 126, in ensure_db
    if not db and http.db_filter([request.session.db]):
  File "/home/peter/odoo/openerp/http.py", line 1379, in db_filter
    dbs = [i for i in dbs if re.match(r, i)]
  File "/usr/lib/python2.7/re.py", line 137, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or buffer

Farid Ghanchi
On 10/2/14, 12:47 AM

When you start the Odoo server  by executing `./openerp-server --db-filter=yourdbname` in the terminal.

Peter Horn
On 9/30/14, 10:42 AM

As described in a Github issue (https://github.com/odoo/odoo/issues/2503), replacing a source code line provides a workaround.

Same error for Odoo 9.0alpha1 and solved as follows
Replace the line 126 en addons/web/controllers/main.py for:

if not db and request.session.db and http.db_filter([request.session.db]):

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 9/30/14, 10:12 AM
Seen: 3176 times
Last updated: 3/16/15, 8:10 AM