QUERY · ISSUE
BUG: sys.modules['sys'] not pointing __import__('sys')
Probably the same reason as :
https://github.com/micropython/micropython/issues/4427
CANDIDATE · PULL REQUEST
ffilib:fix Traceback in Unix port due to missing 'maxsize'
from machine import I2C
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/.micropython/lib/machine/init.py", line 2, in <module>
File "/root/.micropython/lib/machine/timer.py", line 1, in <module>
File "/root/.micropython/lib/ffilib.py", line 43, in <module>
AttributeError: 'module' object has no attribute 'maxsize'
I think the issue here is that micropython-lib's
sysmodule needs to be updated since https://github.com/micropython/micropython/pull/6164 renamed the builtin fromsystousys.So what used to happen is that
import sysgot the builtin, whereas since https://github.com/micropython/micropython/pull/6164 it now gets micropython-lib's empty sys.pyThe fix is that sys.py should "inherit" from usys by having
from usys import *at the start. This is what's done for other modules. Are you able to test that and see if it resolves the issue?The other fix is that micropython-lib shouldn't contain these empty placeholder modules.... see #376 for some thoughts on that.