bixb922 / umidiparser

MIDI file parser for Micropython, CircuitPython and Python
MIT License
28 stars 4 forks source link

SyntaxError: invalid micropython decorator #7

Closed phesterman closed 2 months ago

phesterman commented 6 months ago

How do I avoid this error in CircuitPython? Could you please give a CircuitPython example? Thanks!

bixb922 commented 6 months ago

It seems the @micropython.native decorator is not enabled on all ports of CircuitPython. It used to work at least for RP2040 and ESP32, but it seems not to be supported anymore by CircuitPython. What microcontroller are you using?

This decorator speeds up the code a bit, but is not really important for the workings of umidiparser. As it is, the MIDI parser is quite fast.

Please edit your copy of umidiparser.py and replace all occurrences of @micropython.native with blank or delete/comment all @micropython.native lines. There will be no functional difference.

All examples in the README should work.

Please tell if this worked for you.

phesterman commented 6 months ago

Thanks! It’s working now…that’s all it took. I’m using a Raspberry Pi Pico.

Peter

bixb922 commented 6 months ago

I updated the README with the workaround. Unfortunately, CircuitPython does not allow to redefine @micropython.native as a no-op. Thanks for reporting and enjoy!