Skip to content

Naming of asyncio.py example causes circular import #945

Closed
@feocco

Description

@feocco

Description

The current name of the asyncio example is asyncio.py which matches the library import asyncio. This causes a circular import error.

As a result, the example doesn't run unless the file is renamed.

Could be helpful to rename the example. But, this can at least serve as a searchable reference otherwise.

How to reproduce

# venv steps
virtualenv -p python3 venv
source venv/bin/activate

# Install Libraries
pip install confluent-kafka
pip install pydantic
pip install fastapi
pip install uvicorn

# Run asyncio.py
python asyncio.py

# Receive Error
# AttributeError: partially initialized module 'asyncio' has no attribute 'iscoroutinefunction' (most likely due to a circular import)

# Change file name & run
mv asyncio.py asyc.py
python asyc.py
# INFO:     Started server process [77966]
# INFO:     Waiting for application startup.
# INFO:     Application startup complete.
# INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

Checklist

Please provide the following information:

  • confluent-kafka-python and librdkafka version (confluent_kafka.version() and confluent_kafka.libversion()): 1.5.0
  • Apache Kafka broker version: cp-server:5.4.1
  • Client configuration: {"bootstrap.servers": "localhost:12091"}
  • Operating system: OSX
  • Provide client logs (with 'debug': '..' as necessary)
  • Provide broker log excerpts
  • Critical issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions