pycom / pycom-micropython-sigfox

A fork of MicroPython with the ESP32 port customized to run on Pycom's IoT multi-network modules.
MIT License
199 stars 167 forks source link

NameError: name 'TimeoutError' is not defined #26

Closed dbrgn closed 6 years ago

dbrgn commented 7 years ago

I'm using the LoPy with firmware 1.7.3.b2.

Some functions like LoRa.join raise a TimeoutError if something fails. Python includes that exception since 3.3.

You define the exception in py/objexcept.c:

MP_DEFINE_EXCEPTION(TimeoutError, OSError)

I can catch the exception raised by the LoRa class:

>>> try:
...     lora.lora.join(activation=LoRa.OTAA, auth=lora.auth, timeout=1)
... except Exception as ee:
...     foo = ee
...
>>> foo
TimeoutError('timed out',)
>>> foo.__class__
<class 'TimeoutError'>  

...but the class does not exist in the global namespace!

>>> TimeoutError
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'TimeoutError' is not defined
husigeza commented 6 years ago

Hello,

Thanks for reporting, the fix will be part of the next development release.