Skip to content

ffilib:fix Traceback in Unix port due to missing 'maxsize' #399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pvinci
Copy link

@pvinci pvinci commented Sep 30, 2020

from machine import I2C
Traceback (most recent call last):
File "", line 1, in
File "/root/.micropython/lib/machine/init.py", line 2, in
File "/root/.micropython/lib/machine/timer.py", line 1, in
File "/root/.micropython/lib/ffilib.py", line 43, in
AttributeError: 'module' object has no attribute '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'
@jimmo
Copy link
Member

jimmo commented Oct 1, 2020

I think the issue here is that micropython-lib's sys module needs to be updated since micropython/micropython#6164 renamed the builtin from sys to usys.

So what used to happen is that import sys got the builtin, whereas since micropython/micropython#6164 it now gets micropython-lib's empty sys.py

The 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.

@pvinci pvinci marked this pull request as draft October 1, 2020 00:32
>>> 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'
>>> 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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants