启动 tryton 客户端时出现 KeyError 'res.user'

Posted

技术标签:

【中文标题】启动 tryton 客户端时出现 KeyError \'res.user\'【英文标题】:KeyError 'res.user' when starting tryton client启动 tryton 客户端时出现 KeyError 'res.user' 【发布时间】:2018-02-09 17:51:11 【问题描述】:

环境: MAC High Sierra 运行 Tryton 3.8 TCP/IP

启动 Tryton 客户端时,我得到以下回溯:

Traceback(最近一次调用最后一次):文件 “/site-packages/trytond/protocols/jsonrpc.py”,第 162 行,在 _marshaled_dispatch response['result'] = dispatch_method(method, params) 文件“/site-packages/trytond/protocols/jsonrpc.py”,第 191 行,在 _dispatch res = dispatch(*args) 文件“/site-packages/trytond/protocols/dispatcher.py”,第 41 行,在调度中 res = security.login(database_name, user, session) 文件“/site-packages/trytond/security.py”,第 25 行,登录 User = pool.get('res.user') 文件“/site-packages/trytond/pool.py”,第 172 行,在 get return self._pool[self.database_name][type][name] KeyError: 'res.user'

trytond.conf 内容:

#
# This file contains the most common settings for trytond (Defaults
# are commented).
# For more information read 
# /us`enter code here`r/share/doc/packages/trytond

[database]
# Database related settings

# The URI to connect to the SQL database (following RFC-3986)
# uri = database://username:password@host:port/
# (Internal default: sqlite:// (i.e. a local SQLite database))
#
# PostgreSQL via Unix domain sockets
# (e.g. PostgreSQL database running on the same machine (localhost))
#

#Default setting for a local postgres database

#uri = postgresql:///

#
# PostgreSQL via TCP/IP
# (e.g. connecting to a PostgreSQL database running on a remote machine or
# by means of md5 authentication. Needs PostgreSQL to be configured to accept
# those connections (pg_hba.conf).)
uri=postgresql://jcnorman:29Nov1991@localhost:5432

# The path to the directory where the Tryton Server stores files.
# The server must have write permissions to this directory.
# (Internal default: /var/lib/trytond)
path = /var/lib/tryton

# Shall available databases be listed in the client?
#list = True

# The number of retries of the Tryton Server when there are errors 
# in a request to the database
#retry = 5

# The primary language, that is used to store entries in translatable
# fields into the database.
#language = en_US

[ssl]
# SSL settings
# Activation of SSL for all available protocols.
# Uncomment the following settings for key and certificate
# to enable SSL.

# The path to the private key
#privatekey = /etc/ssl/private/ssl-cert-snakeoil.key

# The path to the certificate
#certificate = /etc/ssl/certs/ssl-cert-snakeoil.pem

[jsonrpc]
# Settings for the JSON-RPC network interface

# The IP/host and port number of the interface
# (Internal default: localhost:8000)
#
# Listen on all interfaces (IPv4)

listen = 0.0.0.0:8000

#
# Listen on all interfaces (IPv4 and IPv6)
#listen = [::]:8000

# The hostname for this interface
#hostname = 

# The root path to retrieve data for GET requests
#data = jsondata

[xmlrpc]
# Settings for the XML-RPC network interface

# The IP/host and port number of the interface
#listen = localhost:8069

[webdav]
# Settings for the WebDAV network interface

# The IP/host and port number of the interface
#listen = localhost:8080

[session]
# Session settings

# The time (in seconds) until an inactive session expires
#timeout = 3600

# The server administration password used by the client for
# the execution of database management tasks. It is encrypted
# using using the Unix crypt(3) routine. A password can be
# generated using the following command line (on one line):
# $ python -c 'import getpass,crypt,random,string; \
# print crypt.crypt(getpass.getpass(), \
# "".join(random.sample(string.ascii_letters + string.digits, 8)))'
# Example password with 'admin'
super_pwd = jkUbZGvFNeugk

[email]
# Mail settings

# The URI to connect to the SMTP server.
# Available protocols are:
# - smtp: simple SMTP
# - smtp+tls: SMTP with STARTTLS
# - smtps: SMTP with SSL
#uri = smtp://localhost:25

# The From address used by the Tryton Server to send emails.
#from = tryton@localhost

[report]
# Report settings

# Unoconv parameters for connection to the unoconv service.
#unoconv = pipe,name=trytond;urp;StarOffice.ComponentContext

# Module settings
#
# Some modules are reading configuration parameters from this
# configuration file. These settings only apply when those modules
# are installed.
#
#[ldap_authentication]
# The URI to connect to the LDAP server.
#uri = ldap://host:port/dn?attributes?scope?filter?extensions
# A basic default URL could look like
#uri = ldap://localhost:389/

[web]
# Path for the web-frontend
#root = /usr/lib/node-modules/tryton-sao

【问题讨论】:

【参考方案1】:

您是否像文档说明的那样初始化了数据库:http://doc.tryton.org/4.6/trytond/doc/topics/setup_database.html#topics-setup-database

trytond-admin -c <config file> -d <database name> --all

【讨论】:

您是否注意到我正在运行 Tryton 3.8?我犹豫是否要迁移到 Tryton V4,但经过进一步研究,我想我会尝试这种方法。我会让你知道我遇到了什么。 我尝试卸载 3.8,安装最新的,并得到以下(从安装显示: 我尝试卸载 3.8,安装最新版本,结果如​​下: trytond-admin -c ~/bryants/trytond.conf -d steve --all Traceback(最近一次通话最后一次) :(忽略之前的评论)文件“/Library/Frameworks/Python.framework/Versions/2.7/bin/trytond-admin”,第 21 行,在 admin.run(options) 中。 . .中间消息的长度被删除 trytond.exceptions.MissingDependenciesException: Missing dependencies: webdav 执行 pip install tr​​ytond_webdav 后,现在我得到:文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trytond/modules/currency/__init__ .py”,第 5 行,在 中从 .currency 导入 * 文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trytond/modules/currency/currency.py ",第 6 行,在 中 from trytond.tools import safe_eval, datetime_strftime ImportError: cannot import name safe_eval 我看到了问题 - 我使用的是旧版本的 Currency。

以上是关于启动 tryton 客户端时出现 KeyError 'res.user'的主要内容,如果未能解决你的问题,请参考以下文章

Key存在时出现KeyError

将文件发送到 django 时出现 Keyerror/MultiValueDictKeyError

使用熊猫数据框时出现 KeyError

在 Python 中解析 JSON 结果时出现 KeyError

KeyError:安装软件包时出现'vendor_id'

尝试更改 kivymd 标签文本时出现 KeyError