Skip to content

Bug - factory using ignore-external #292

@JeanLucPons

Description

@JeanLucPons

factory fails with a strange error when ignore external is used and that an unknow module is found.
In the above case it should work using ignore_external=True

>>> sr = Accelerator.load("tests/config/EBSTune.yaml",ignore_external=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/esrf/pons/pyaml/pyaml/accelerator.py", line 304, in load
    return manager.build(ignore_external=ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/manager.py", line 496, in build
    return Accelerator.from_dict(snapshot, ignore_external=ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/accelerator.py", line 275, in from_dict
    return Factory.build(config_dict, ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 550, in build
    data = self._build_dict(data, ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 397, in _build_dict
    result[key] = self.build(value, ignore_external)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 547, in build
    return self._build_list(data, ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 362, in _build_list
    return [self.build(item, ignore_external) if isinstance(item, (dict, list)) else item for item in items]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 550, in build
    data = self._build_dict(data, ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 383, in _build_dict
    config_cls = build_info.config_cls
                 ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'config_cls'
>>> sr = Accelerator.load("tests/config/EBSTune.yaml")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/esrf/pons/pyaml/pyaml/accelerator.py", line 304, in load
    return manager.build(ignore_external=ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/manager.py", line 496, in build
    return Accelerator.from_dict(snapshot, ignore_external=ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/accelerator.py", line 275, in from_dict
    return Factory.build(config_dict, ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 550, in build
    data = self._build_dict(data, ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 397, in _build_dict
    result[key] = self.build(value, ignore_external)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 547, in build
    return self._build_list(data, ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 362, in _build_list
    return [self.build(item, ignore_external) if isinstance(item, (dict, list)) else item for item in items]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 550, in build
    data = self._build_dict(data, ignore_external)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 382, in _build_dict
    build_info = resolve_build_info(data, ignore_external)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esrf/pons/pyaml/pyaml/configuration/factory.py", line 238, in resolve_build_info
    raise PyAMLConfigException(
pyaml.common.exception.PyAMLConfigException: Module referenced in tango.pyaml.tango_controlsystem cannot be found: No module named 'tango.pyaml.tango_controlsystem' /home/esrf/pons/pyaml/tests/config/EBSTune.yaml at line 10, column 5. while

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions