MemoryError when loading python library

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
ps_nithin
Posts: 14
Joined: Sat Jun 18, 2022 1:44 pm

MemoryError when loading python library

Post by ps_nithin » Sun Aug 14, 2022 8:49 am

When trying to load purepng "python" library in arduino nano rp2040 connect i am getting the following error.
>>> import png
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
MemoryError: memory allocation failed, allocating 1016 bytes
>>>
Any ideas? How to fix this?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: MemoryError when loading python library

Post by jimmo » Wed Aug 17, 2022 3:03 am

Are you using https://github.com/Scondo/purepng directly? It's very much not designed for MicroPython.

I found this library which looks like an attempt to minify it somewhat -- https://github.com/Ratfink/micropython- ... ter/png.py

ps_nithin
Posts: 14
Joined: Sat Jun 18, 2022 1:44 pm

Re: MemoryError when loading python library

Post by ps_nithin » Wed Aug 17, 2022 1:17 pm

I was trying to adapt https://github.com/Scondo/purepng to micropython. https://github.com/Ratfink/micropython- ... ter/png.py works only partly. It doesn't allow you to write png file.
Thanks,

Post Reply