Skip to content

Engaging sensor ImportError: cannot import name 'TypeGuard' #5397

@DavidMeu

Description

@DavidMeu

Recieving the following error while trying to engage sensor:

st2.STDERR ERROR [-] Failed to load sensor class from file "/opt/stackstorm/packs/some_pack/sensors/some_sensor.py" (sensor file most likely doesn't exist or contains invalid syntax): cannot import name 'TypeGuard'

Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/st2reactor/container/sensor_wrapper.py", line 299, in _get_sensor_insta
nce
    class_name=self._class_name)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/st2common/util/loader.py", line 146, in register_plugin_class
    module = imp.load_source(module_name, file_path)
  File "/opt/stackstorm/virtualenvs/some_pack/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/stackstorm/packs/some_pack/sensors/some_sensor.py", line 3, in <module>
    from typing_extensions import TypeGuard
ImportError: cannot import name 'TypeGuard'

Saw the source of the module is: /opt/stackstorm/st2/lib/python3.6/site-packages/typing_extensions.py
But not sure who is responsible for installing it.

st2 3.4.0, on Python 3.6.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions