Python on Raspberry Pi, a note about structure, or something.

I’ve been struggling with a problem with a Pi camera for a couple of days. Instead of being able to start up the camera, I just had error messages about MMAL running out of resources.

Now, I knew I’d seen it before, and sure enough, Stack Overflow had quite a lot of questions about it. But I’d seen them before. And then I remembered that I never found out why the problem went away before.

As an experiment, I tried something that I thought couldn’t possibly work, and suddenly everything worked. All it took was moving the camera instantiation from the top of the program to just below all the function declarations.

At a guess, the camera startup can’t get the resources it needs, because the Python interpreter is chewing its way though all the function declarations, and using up something the camera software wanted.

It’s an age or so, since I wrote a language interpreter, and it was for a simple language, Pilot, but I know interpreters have reasons for liking programs in a particular order, so that’s my guess…

#MMALresources
Me, wearing a Panama hat, spectacles, and a fine growth of facial hair.

Author: Walrus

Just this guy, you know.