gpt4 book ai didi

postgresql - 值错误 : a string literal cannot contain nul (0x00) characters odoo

转载 作者:行者123 更新时间:2023-11-29 14:03:25 30 4
gpt4 key购买 nike

我在尝试导入用户时遇到此错误

注意:

该模块工作正常:我可以使用 odoo 10 和 postgres 9.3 ubuntu 14 导入用户

但这里我使用的是 postgres 9.5 odoo 10 ubuntu 16

  File "/home/belazar/Documents/addons_odoo10/hr_biometric_machine/models/biometric_machine.py", line 113, in create_user
'biometric_device': self.id, }
File "/opt/odoo/odoo/models.py", line 3830, in create
record = self.browse(self._create(old_vals))
File "/opt/odoo/odoo/models.py", line 3925, in _create
cr.execute(query, tuple(u[2] for u in updates if len(u) > 2))
File "/opt/odoo/odoo/sql_db.py", line 154, in wrapper
return f(self, *args, **kwargs)
File "/opt/odoo/odoo/sql_db.py", line 231, in execute
res = self._obj.execute(query, params)
ValueError: A string literal cannot contain NUL (0x00) characters.

最佳答案

问题通过在 /opt/odoo/odoo/sql_db.py 上注释这些行来解决:

#from tools import parse_version as pv
#if pv(psycopg2.__version__) < pv('2.7'):
# from psycopg2._psycopg import QuotedString
# def adapt_string(adapted):
# """Python implementation of psycopg/psycopg2#459 from v2.7"""
# if '\x00' in adapted:
# raise ValueError("A string literal cannot contain NUL (0x00) characters.")
# return QuotedString(adapted)

#psycopg2.extensions.register_adapter(str, adapt_string)
#psycopg2.extensions.register_adapter(unicode, adapt_string)

关于postgresql - 值错误 : a string literal cannot contain nul (0x00) characters odoo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45056178/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com