KeyError: 'model' in XML

I have been working on a module for 2 months. Right up till now, my module was working perfectly. But now when I installed a new module and updated the schema, the following error came from the module I was working on before.

File "/usr/lib/python3.6/xml/sax/expatreader.py", line 111, in parse
self.feed(buffer)
File "../Modules/pyexpat.c", line 419, in StartElement
self._cont_handler.startElement(name, AttributesImpl(attrs))
self.taghandler.startElement(name, attributes)
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/trytond-5.0.14-py3.6.egg/trytond/convert.py", line 185, in startElement
self.model = self.mh.pool.get(attributes["model"])
File "/usr/lib/python3.6/xml/sax/xmlreader.py", line 318, in __getitem__
return self._attrs[name]
KeyError: 'model'
Traceback (most recent call last):
File "/home/elf9/workspace/apar_tryton/bin/trytond-admin", line 4, in <module>
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/pkg_resources/__init__.py", line 658, in run_script
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1438, in run_script
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/trytond-5.0.14-py3.6.egg/EGG-INFO/scripts/trytond-admin", line 21, in <module>
admin.run(options)
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/trytond-5.0.14-py3.6.egg/trytond/admin.py", line 54, in run
activatedeps=options.activatedeps)
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/trytond-5.0.14-py3.6.egg/trytond/pool.py", line 160, in init
lang=lang, activatedeps=activatedeps)
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/trytond-5.0.14-py3.6.egg/trytond/modules/__init__.py", line 418, in load_modules
_load_modules(update)
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/trytond-5.0.14-py3.6.egg/trytond/modules/__init__.py", line 388, in _load_modules
load_module_graph(graph, pool, update, lang)
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/trytond-5.0.14-py3.6.egg/trytond/modules/__init__.py", line 230, in load_module_graph
tryton_parser.parse_xmlstream(fp)
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/trytond-5.0.14-py3.6.egg/trytond/convert.py", line 451, in parse_xmlstream
self.sax_parser.parse(source)
File "/usr/lib/python3.6/xml/sax/expatreader.py", line 111, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.6/xml/sax/xmlreader.py", line 125, in parse
self.feed(buffer)
File "/usr/lib/python3.6/xml/sax/expatreader.py", line 217, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 419, in StartElement
File "/usr/lib/python3.6/xml/sax/expatreader.py", line 333, in start_element
self._cont_handler.startElement(name, AttributesImpl(attrs))
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/trytond-5.0.14-py3.6.egg/trytond/convert.py", line 487, in startElement
self.taghandler.startElement(name, attributes)
File "/home/elf9/workspace/apar_tryton/lib/python3.6/site-packages/trytond-5.0.14-py3.6.egg/trytond/convert.py", line 185, in startElement
self.model = self.mh.pool.get(attributes["model"])
File "/usr/lib/python3.6/xml/sax/xmlreader.py", line 318, in __getitem__
return self._attrs[name]
KeyError: 'model'

I looked through the XML file causing this error multiple times but there was nothing wrong with it and the module was working perfectly before.

I then proceeded to create a new virtual environment for Tryton, reinstall trytond and use a new database but the same error popped up again.

Please help.

P.S. the new module has nothing to do with the old module (no common dependencies, and they do not depend upon each other), and the new module and all other modules are working perfectly except for the old module

There is a <record/> tag missing a model attribute. This new test Issue 8556: Invalid group attribute for message files - Tryton issue tracker should help detect which record.

1 Like

Thanks! I found out that due to some bug in my IDE, a record tag had ‘ref’ written instead of ‘model’. I changed it back and now it works perfectly.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.