Memory allocation failed

General discussion about topics related to OpenMV.
lab
Posts: 20
Joined: Wed Mar 21, 2018 9:02 pm

Memory allocation failed

Postby lab » Wed Dec 19, 2018 4:37 pm

I noticed that my code won't run if I include in the code long lists with numeric entries. I get the following error when press run:

MemoryError: memory allocation failed, allocating 3652 bytes.

Could I save the list as a text file on the board and read the file when I run my code instead?
User avatar
kwagyeman
Posts: 3051
Joined: Sun May 24, 2015 2:10 pm

Re: Memory allocation failed

Postby kwagyeman » Thu Dec 20, 2018 2:22 am

Sure, just use the standard

Code: Select all

with open("/file.txt", "r") as file:
    file.read()
And etc. python coding style.
Nyamekye,

Return to “General Topics”

Who is online

Users browsing this forum: Bing [Bot] and 3 guests