Lv_micropython import display_driver error

>>> import display driver
Traceback (most recent call last):
  File "<stdin>", line 1
SyntaxError: invalid syntax
>>> import display_driver
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "", line 1, in <module>
  File "", line 5, in <module>
  File "", line 45, in <module>
RuntimeError: Missing machine.Timer implementation!

Hi @somebodyLi !
Could you provide some context?
What port are you building?
It looks like your port is missing “machine.Timer” module so it’s probably not unix, esp32 or stm32.
Or did you change something in lv_micropython?

Hi @amirgon
I build unix port on macos, the only change I made is like this

- CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith -Wdouble-promotion -Wfloat-conversion
+ CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith -Wdouble-promotion -Wfloat-conversion -Wno-tautological-overlap-compare

and the __attribute__ to make it compiled.
I aware that there is a fallback for machine.Timer lv_timer. I don’t know why it’s doesn’t work.

It looks like something local to your environment. specifies the frozen modules, among them.

Let’s find out if the problem is specific to, or general to frozen Python modules.
Even if a module is frozen, maybe it’s not found due to python path.

I can suggest the following:

  • Clean and rebuild lv_micropython. Make sure you update git submodules recursively beforehand.
  • Make sure libffi is not missing. See:
  • Try to import explicitly from the REPL. Does it work?
  • Try to import some other frozen modules from the REPL. upip for example. Does it work?

Also, try to add frozen modules to Micropython path.

Hi @amirgon !

  1. submodules update already
  2. libffi is up to date

it seems that the mpython path is fine

You got OSError: [Error 2] ENOENT thrown on line 18:

It seems that is not available on mac os.
According to this on mac os it should be libc.dylib, and should also change.

Could you try changing the shared library names on and see if it helps?

yep, thanks, I have a try

Hi @amirgon !
here is another problem about librt

It seems that it’s complex to solve, I plane to do it with docker(it works). anyway, thanks a lot @amirgon

So it seems that cannot be used on Mac. But you don’t have to use it. Both the FB and SDL drivers provide an internal event loop when the external one is missing. Just use them directly instead of importing display_driver.