python - odoo11 库存模块安装时出现 python yaml 错误。yaml.constructor.ConstructorError:无法确定标签“!python”的构造函数
问题描述
我已经设置了一个odoo11
数据库并尝试安装 stock 模块,但它会生成 python yaml 错误。
错误日志:
2019-04-09 12:21:06,147 15820 INFO sicpa_db odoo.modules.loading: loading stock/views/stock_template.xml
2019-04-09 12:21:06,391 15820 INFO sicpa_db odoo.modules.loading: loading stock/views/procurement_views.xml
2019-04-09 12:21:06,546 15820 INFO sicpa_db odoo.modules.loading: loading stock/data/default_barcode_patterns.xml
2019-04-09 12:21:06,592 15820 INFO sicpa_db odoo.modules.loading: loading stock/data/stock_data.xml
2019-04-09 12:21:07,294 15820 INFO sicpa_db odoo.modules.loading: loading stock/data/stock_data.yml
2019-04-09 12:21:07,300 15820 WARNING sicpa_db odoo.modules.loading: Transient module states were reset
2019-04-09 12:21:07,336 15820 ERROR sicpa_db odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/home/gajanan/others/erp/odoo11-git/odoo/modules/registry.py", line 85, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/gajanan/others/erp/odoo11-git/odoo/modules/loading.py", line 380, in load_modules
loaded_modules, update_module, models_to_check)
File "/home/gajanan/others/erp/odoo11-git/odoo/modules/loading.py", line 274, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/home/gajanan/others/erp/odoo11-git/odoo/modules/loading.py", line 181, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/home/gajanan/others/erp/odoo11-git/odoo/modules/loading.py", line 95, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/home/gajanan/others/erp/odoo11-git/odoo/tools/convert.py", line 789, in convert_file
convert_yaml_import(cr, module, fp, kind, idref, mode, noupdate, report)
File "/home/gajanan/others/erp/odoo11-git/odoo/tools/yaml_import.py", line 854, in yaml_import
yaml_interpreter.process(yaml_string)
File "/home/gajanan/others/erp/odoo11-git/odoo/tools/yaml_import.py", line 794, in process
for node in yaml.load(yaml_string):
File "/home/gajanan/.local/lib/python3.5/site-packages/yaml/__init__.py", line 114, in load
File "/home/gajanan/.local/lib/python3.5/site-packages/yaml/constructor.py", line 43, in get_single_data
File "/home/gajanan/.local/lib/python3.5/site-packages/yaml/constructor.py", line 52, in construct_document
File "/home/gajanan/.local/lib/python3.5/site-packages/yaml/constructor.py", line 404, in construct_yaml_map
File "/home/gajanan/.local/lib/python3.5/site-packages/yaml/constructor.py", line 210, in construct_mapping
File "/home/gajanan/.local/lib/python3.5/site-packages/yaml/constructor.py", line 131, in construct_mapping
File "/home/gajanan/.local/lib/python3.5/site-packages/yaml/constructor.py", line 92, in construct_object
File "/home/gajanan/.local/lib/python3.5/site-packages/yaml/constructor.py", line 420, in construct_undefined
yaml.constructor.ConstructorError: could not determine a constructor for the tag '!python'
in "<byte string>", line 2, column 3:
!python {model: ir.model.data, i ...
^
我也无法安装其他应用程序,请帮助。
解决方案
您可能会遇到问题,因为 PyYAML 发生了一些重大更改,并且依赖于 PyYAML 的包尚未更新和/或未固定到旧版本的 PyYAML。
您应该做的是运行pip list
并查看您拥有的 PyYAML 版本。如果该版本 >= 4.0,则运行:
pip install -U pyyaml==3.13
PyYAML 不在requirements.txt
for odoo 中,因此您可能获得了最新版本的 PyYAML,它不(不再)兼容。
推荐阅读
- html - ngx-sharebuttons 中是否有 .css 版本的主题用于社交分享?
- json - JSON中的意外字符串在位置
通过邮递员寄送尸体 - android - “反应原生链接反应原生声音”不起作用
- javascript - 如何制作一个函数,在javascript中按降序排序并返回数组中重复次数最多的值?
- php - 为我的 CMS 解密或加密 rijndael 哈希时出现问题,这是 php 中的源代码
- reactjs - React 代理,服务器响应状态为 404 (Not Found)
- gremlin - 海王星小精灵中的排序(排序)非常慢
- r - 未生成图例或生成错误地分配给数据
- html - 角度旋转木马,旋转木马内的点击事件未按预期工作
- sql-server - 多列分组