error when trying to use "from . import"
Posted: Sun Nov 13, 2016 5:23 am
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
>>> 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