eht16 / python-logstash-async

Python logging handler for sending log events asynchronously to Logstash.
MIT License
186 stars 51 forks source link

ImportError: cannot import name 'ParamSpec' from 'typing_extensions' on Python 3.11 #77

Closed mar10 closed 1 year ago

mar10 commented 1 year ago

May be that Python 3.11 is not supported yet?

from logstash_async.transport import HttpTransport
from logstash_async.handler import AsynchronousLogstashHandler

the second line fails with

...
  File "C:\prj\PLX_e1ns\common\src\plato\common\log_tools.py", line 206, in add_logstash_handler_to_logger
    from logstash_async.handler import AsynchronousLogstashHandler
  File "C:\VirtualEnv\python-3.11.1\.virtualenvs\e1ns_trunk\Lib\site-packages\logstash_async\handler.py", line 11, in <module>
    from logstash_async.worker import LogProcessingWorker
  File "C:\VirtualEnv\python-3.11.1\.virtualenvs\e1ns_trunk\Lib\site-packages\logstash_async\worker.py", line 12, in <module>
    from limits import parse as parse_rate_limit
  File "C:\VirtualEnv\python-3.11.1\.virtualenvs\e1ns_trunk\Lib\site-packages\limits\__init__.py", line 5, in <module>
    from . import _version, aio, storage, strategies
  File "C:\VirtualEnv\python-3.11.1\.virtualenvs\e1ns_trunk\Lib\site-packages\limits\aio\__init__.py", line 1, in <module>
    from . import storage, strategies
  File "C:\VirtualEnv\python-3.11.1\.virtualenvs\e1ns_trunk\Lib\site-packages\limits\aio\storage\__init__.py", line 6, in <module>
    from .base import MovingWindowSupport, Storage
  File "C:\VirtualEnv\python-3.11.1\.virtualenvs\e1ns_trunk\Lib\site-packages\limits\aio\storage\base.py", line 5, in <module>
    from limits.storage.registry import StorageRegistry
  File "C:\VirtualEnv\python-3.11.1\.virtualenvs\e1ns_trunk\Lib\site-packages\limits\storage\__init__.py", line 12, in <module>
    from .base import MovingWindowSupport, Storage
  File "C:\VirtualEnv\python-3.11.1\.virtualenvs\e1ns_trunk\Lib\site-packages\limits\storage\base.py", line 4, in <module>
    from limits.storage.registry import StorageRegistry
  File "C:\VirtualEnv\python-3.11.1\.virtualenvs\e1ns_trunk\Lib\site-packages\limits\storage\registry.py", line 5, in <module>
    from limits.typing import Dict, List, Tuple, Union
  File "C:\VirtualEnv\python-3.11.1\.virtualenvs\e1ns_trunk\Lib\site-packages\limits\typing.py", line 14, in <module>
    from typing_extensions import ClassVar, Counter, ParamSpec, Protocol
ImportError: cannot import name 'ParamSpec' from 'typing_extensions' (C:\VirtualEnv\python-3.11.1\.virtualenvs\e1ns_trunk\Lib\site-packages\typing_extensions.py)
eht16 commented 1 year ago

The ImportError is raised from the limits package.

You could try a newer version of the limits package, v2.7.2 was release on 2022-12-11 which supports Python 3.11.

Re-open if this doesn't help.