You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your PLC project repo is missing a file (any file, even one not related to the ioc build), the pytmc template command fails with a confusing error:
Traceback (most recent call last):
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/bin/pytmc", line 10, in <module>
sys.exit(main())
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/bin/pytmc.py", line 106, in main
func(**kwargs)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/bin/template.py", line 830, in main
raise stashed_exception
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/bin/template.py", line 821, in main
template_args.update(projects_to_dict(*projects))
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/bin/template.py", line 268, in projects_to_dict
for key, value in project_to_dict(path).items():
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/bin/template.py", line 219, in project_to_dict
projects = {fn: parser.parse(fn) for fn in project_files}
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/bin/template.py", line 219, in <dictcomp>
projects = {fn: parser.parse(fn) for fn in project_files}
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 51, in parse
return TwincatItem.parse(root, filename=fn, parent=parent)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 407, in parse
return cls(element, parent=parent, filename=filename, name=name)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 224, in __init__
self._add_children(element)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 300, in _add_children
self._add_child(child_element)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 309, in _add_child
child = self.parse(element, parent=self, filename=self.filename)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 407, in parse
return cls(element, parent=parent, filename=filename, name=name)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 224, in __init__
self._add_children(element)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 300, in _add_children
self._add_child(child_element)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 309, in _add_child
child = self.parse(element, parent=self, filename=self.filename)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 407, in parse
return cls(element, parent=parent, filename=filename, name=name)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 224, in __init__
self._add_children(element)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 2134, in _add_children
self._finish_lazy_loading(self._xti_files)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 347, in _finish_lazy_loading
self._children[idx] = child.load(file_map)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 455, in load
obj._finish_lazy_loading(file_map)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 349, in _finish_lazy_loading
child._finish_lazy_loading(file_map)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 347, in _finish_lazy_loading
self._children[idx] = child.load(file_map)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 455, in load
obj._finish_lazy_loading(file_map)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 349, in _finish_lazy_loading
child._finish_lazy_loading(file_map)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 347, in _finish_lazy_loading
self._children[idx] = child.load(file_map)
File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.1/lib/python3.9/site-packages/pytmc/parser.py", line 453, in load
info = file_map[self.key]
KeyError: (<class ‘pytmc.parser.Box’>, ‘15’, ‘ffo.xti’)
It's good that this gets caught in some capacity, but the error should be made more clear, e.g. something like: "RuntimeError: file named {filename} missing from the repo!"
We can probably handle this by catching a KeyError in this line:
If your PLC project repo is missing a file (any file, even one not related to the ioc build), the
pytmc template
command fails with a confusing error:It's good that this gets caught in some capacity, but the error should be made more clear, e.g. something like:
"RuntimeError: file named {filename} missing from the repo!"
We can probably handle this by catching a
KeyError
in this line:pytmc/pytmc/parser.py
Line 453 in 2c4f412
The text was updated successfully, but these errors were encountered: