无法在数据库中更新trytond

时间:2014-07-19 23:12:06

标签: python tryton

我正在尝试在我的数据库中添加一个新模块。 我遇到了这个问题,我无法解决任何问题。 我的 init .py的代码是:

from trytond.pool import Pool

from grh.Employe import *


def register():
    Pool.register(
        Employe,
        module='grh', type_='model')

尝试后的问题是:

  File "/usr/local/bin/trytond", line 5, in <module>
    pkg_resources.run_script('trytond==3.2.2', 'trytond')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 528, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1394, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/EGG-INFO/scripts/trytond", line 113, in <module>
    trytond.server.TrytonServer(options).run()
  File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/trytond/server.py", line 123, in run
    Pool(db_name).init(update=update, lang=lang)
  File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/trytond/pool.py", line 151, in init
    lang=lang)
  File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/trytond/modules/__init__.py", line 428, in load_modules
    _load_modules()
  File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/trytond/modules/__init__.py", line 393, in _load_modules
    graph = create_graph(module_list)[0]
  File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/trytond/modules/__init__.py", line 159, in create_graph
    raise Exception('Module %s not found' % module)
请帮助我

1 个答案:

答案 0 :(得分:1)

您正在从/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg运行服务器,因此该模块必须位于/ usr / local / lib / python2中.7 / dist-packages / trytond-3.2.2-py2.7.egg / trytond / modules /文件夹或安装在/usr/local/lib/python2.7/dist-packages /

对于开发建议,我建议您在不安装软件包的情况下从源代码运行。如果您已完成此操作,则表示您未连接到正确的tryton实例。

如果要始终安装模块,只需运行python setup.py install(假设您的自定义模块使用正确的方法和名称定义了setup.py文件)。

您可以在http://hg.tryton.org/tryton-tools/file/b1bf3e9fe771/contrib-module-setup.tmpl

上找到setup.py的模板