sivulich / mqttasgi

MQTT ASGI Protocol Server
MIT License
34 stars 15 forks source link

ImportError: cannot import name 'main' from 'mqttasgi.cli' #1

Closed DrGhonzo closed 2 years ago

DrGhonzo commented 2 years ago

After follows the "how-to" steps in README with the description below

On PyCharm 2021.2.2 with the following libraries:

Python==3.7
Django==3.2.11
channels==3.0.4
mqttasgi==0.3.0
paho-mqtt==1.6.1

I have the following traceback error:

PS C:\Users\Dr.Ghonzo\PycharmProjects\testProject> cd app
PS C:\Users\Dr.Ghonzo\PycharmProjects\testProject\app> mqttasgi -H localhost -p 1883 mqtt_app.asgi:application
Traceback (most recent call last):
  File "C:\Users\Dr.Ghonzo\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\Dr.Ghonzo\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Dr.Ghonzo\PycharmProjects\testProject\env\Scripts\mqttasgi.exe\__main__.py", line 4, in <module>
ImportError: cannot import name 'main' from 'mqttasgi.cli' (c:\users\dr.ghonzo\pycharmprojects\testproject\env\lib\site-packages\mqttasgi\cli.py)
PS C:\Users\Dr.Ghonzo\PycharmProjects\testProject\app>
sivulich commented 2 years ago

Hi @DrGhonzo, thanks for submitting the error.

It seems to be a configuration error in the cli. We will fix this by moving the code to a main function in the cli.

But this will only work for Django 2.x and channels 2.x. We will update with a Major to support Django and channels 3.x but this can take a little bit more time.

sivulich commented 2 years ago

Fixed in release 0.3.2