Today I compiled 'MicroPython v1.8.6-9-g30cfdc2 on 2016-11-13' to Esp and installed uqmtt.robust using upip. This installation created files robust.py and simple.py at /lib/umqtt/ dir as expected. But when I tried to import robust I got:
>>> from umqtt import robust
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/lib/umqtt/robust.py", line 4, in <module>
AttributeError: 'module' object has no attribute 'MQTTClient'
and this is because of robust.py line 2: 'from . import simple'.
>>> from . import simple
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: __main__
It seams that mycropython doesn't recognize this dot as a current directory because this way I succeeded to import robust.py:
>>> from umqtt import simple
>>> from umqtt import robust
error when trying to use "from . import"
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: error when trying to use "from . import"
I suggest you raise an issue against micropython-lib https://github.com/micropython/micropython-lib.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.