I'm setting up a development environment for Odoo 18 on a Windows machine. I've cloned the repository, created a virtual environment (venv), and successfully installed all dependencies from the requirements.txt file.
However, when I try to start the Odoo server for the first time using the command below, the process fails with a UnicodeDecodeError.
Command executed:
PowerShell
(venv) PS D:\tarefas\trarefa_kaue_1\teste\odoo> python odoo-bin -r odoo -w 123
Full Error (Traceback):
2025-08-16 04:07:47,493 14676 INFO ? odoo: Odoo version 18.0
2025-08-16 04:07:47,493 14676 INFO ? odoo: addons paths: ['D:\\tarefas\\trarefa_kaue_1\\teste\\odoo\\odoo\\addons', 'c:\\users\\kauen\\appdata\\local\\openerp s.a\\odoo\\addons\\18.0', 'd:\\tarefas\\trarefa_kaue_1\\teste\\odoo\\odoo\\addons', 'd:\\tarefas\\trarefa_kaue_1\\teste\\odoo\\addons']
2025-08-16 04:07:47,493 14676 INFO ? odoo: database: odoo@default:default
2025-08-16 04:07:50,148 14676 INFO ? odoo.addons.base.models.ir_actions_report: You need Wkhtmltopdf to print a pdf version of the reports.
2025-08-16 04:07:50,152 14676 INFO ? odoo.addons.base.models.ir_actions_report: You need Wkhtmltoimage to generate images from html.
2025-08-16 04:07:52,396 14676 INFO ? odoo.service.server: HTTP service (werkzeug) running on kaue_martins.intelbras.local:8069
Exception in thread odoo.service.cron.cron0:
Traceback (most recent call last):
File "C:\Python312\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
File "C:\Python312\Lib\threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "D:\tarefas\trarefa_kaue_1\teste\odoo\odoo\service\server.py", line 541, in target
self.cron_thread(i)
File "D:\tarefas\trarefa_kaue_1\teste\odoo\odoo\service\server.py", line 522, in cron_thread
with contextlib.closing(conn.cursor()) as cr:
File "D:\tarefas\trarefa_kaue_1\teste\odoo\odoo\sql_db.py", line 799, in cursor
return Cursor(self.__pool, self.__dbname, self.__dsn)
File "D:\tarefas\trarefa_kaue_1\teste\odoo\odoo\sql_db.py", line 288, in __init__
self._cnx = pool.borrow(dsn)
File "D:\tarefas\trarefa_kaue_1\teste\odoo\venv\Lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "D:\tarefas\trarefa_kaue_1\teste\odoo\odoo\tools\func.py", line 97, in locked
return func(inst, *args, **kwargs)
File "D:\tarefas\trarefa_kaue_1\teste\odoo\odoo\sql_db.py", line 726, in borrow
result = psycopg2.connect(
File "D:\tarefas\trarefa_kaue_1\teste\odoo\venv\Lib\site-packages\psycopg2\__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 78: invalid continuation byte
My Environment Details:
OS: Windows 11
Odoo: Version 18.0
Python: Version 3.12 (installed at C:\Python312)
PostgreSQL: Version 15
What I've investigated so far:
The traceback indicates the error occurs during the psycopg2.connect call, which is the library used to connect to PostgreSQL.
The UnicodeDecodeError with byte 0xe7 suggests there's a special character (likely ç in a latin-1 or windows-1252 encoding) somewhere in the connection string that is not UTF-8 encoded.
I have checked the parameters I passed on the command line (-r odoo and -w 123), and they do not contain any special characters.
The PostgreSQL database was initialized with UTF-8 encoding.
My suspicion is that the problem might be in a Windows environment variable or in the Odoo configuration file (odoo.conf), which might be read with an incorrect encoding (like windows-1252) instead of UTF-8.
My questions are:
Where do Odoo or psycopg2 on Windows look for connection information besides the command-line parameters?
What is the most likely cause for this UnicodeDecodeError in this scenario, and how can I fix it?
Thanks for any help!
That 0xe7 is the ç character (c cedille). Somewhere in your database DSN (connection string, database name...) or Windows environment variable there’s a non-UTF-8 character (probably ç in a folder, user, or host name...).
On Windows, psycopg2 builds the DSN based on :
odoo-bin's arguments that you pass to psycopg2.connect(): https://www.odoo.com/documentation/18.0/developer/reference/cli.html
• -d ,--database
• -r ,--db_user
• -w , --db_password
• --db_host
• --db_port
odoo_file.conf (Odoo config file to store parameters) https://www.odoo.com/documentation/18.0/developer/reference/cli.html#reference-cmdline-config
• db_host = localhost
• db_port = 5432
• db_user = odoo
• db_password = 123
Environment variables (used if above are missing):
• PGHOST
• PGPORT
• PGUSER
• PGPASSWORD
• PGDATABASE
Postgres service file (%APPDATA%\postgresql\pg_service.conf)