faust-streaming / mode

Python AsyncIO Services
https://faust-streaming.github.io/mode/
Other
42 stars 16 forks source link

AttributeError: module 'mode' has no attribute 'Worker' #27

Closed wbarnha closed 1 year ago

wbarnha commented 1 year ago

This must've been introduced in #24 and didn't get detected in our initial tests.

  File "/usr/local/lib/python3.10/dist-packages/faust/types/settings/base.py", line 172, in _init_settings
    param.on_init_set_default(conf, provided_value)
  File "/usr/local/lib/python3.10/dist-packages/faust/types/settings/params.py", line 435, in on_init_set_default
    conf, self.storage_name, self.prepare_init_default(conf, default_value)
  File "/usr/local/lib/python3.10/dist-packages/faust/types/settings/params.py", line 472, in prepare_init_default
    return self.to_python(conf, value)
  File "/usr/local/lib/python3.10/dist-packages/faust/types/settings/params.py", line 736, in to_python
    return cast(OT, symbol_by_name(value))
  File "/usr/local/lib/python3.10/dist-packages/mode/utils/imports.py", line 268, in symbol_by_name
    module = imp(  # type: ignore
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.10/dist-packages/faust/worker.py", line 142, in <module>
    class Worker(mode.Worker):
AttributeError: module 'mode' has no attribute 'Worker'

I yanked 0.3.0 immediately so that hopefully no prod environments will be affected by this issue.

lindycoder commented 1 year ago

I have a similar issue, importing Worker from faust

  File ".../app.py", line 5, in <module>
    from faust import App, Settings, Worker
ImportError: cannot import name 'Worker' from 'faust' (.../.venv/lib/python3.9/site-packages/faust/__init__.py)

Worked with mode-streaming 0.2.1

Is this related?

wbarnha commented 1 year ago

Yes it is, I'm terribly sorry you're running into this issue. Just stick with 0.2.1 for now, I'm currently working on a patch and will release 0.3.1 to fix this.