I am playing with
sys.settrace on an
ESP8266 an I find it to work quite well: I am using it to send some information on
UART(1) in order to help me analyse how my code is running.
However now I get an error that I was not having when using the standard firmware (the one without
sys.settrace):
Code: Select all
>>> import usyslog
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "usyslog.py", line 11, in <module>
NameError: name 'const' isn't defined
>>>
I have checked that
micropython.const still exists in that firmware:
Code: Select all
>>> import micropython
>>> micropython.const(1)
1
>>>
I believe there is a bug with the
sys.settrace-enabled firmware but I have no clue how to find it??!
-------------------------
EDIT: to solve this issue I added
from micropython import const before line 11 in
usyslog.py.
Now the question is:
Why did
import usyslog worked flawlessly with the standard firmware without this modification?
Or more exactly why
a = const(1) works by default with the normal firmware:
Code: Select all
>>> const(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'const' isn't defined
>>> a = const(1)
>>>
while with the
sys.settrace-enabled firmware one has to import
const before:
Code: Select all
>>> const(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'const' isn't defined
>>> a = const(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'const' isn't defined
>>> from micropython import const
>>> const(1)
1
>>> a = const(1)
>>>
?