{"id":127,"date":"2023-08-28T18:17:00","date_gmt":"2023-08-28T18:17:00","guid":{"rendered":""},"modified":"2024-01-08T13:27:00","modified_gmt":"2024-01-08T13:27:00","slug":"python-on-raspberry-pi-a-note-about-structure-or-something","status":"publish","type":"post","link":"https:\/\/doctor-dark.co.uk\/blog\/python-on-raspberry-pi-a-note-about-structure-or-something\/","title":{"rendered":"Python on Raspberry Pi, a note about structure, or something."},"content":{"rendered":"<div style=\"text-align: left;\"><span style=\"font-family: Tahoma; font-size: medium;\">I&#8217;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.<\/span><\/div>\n<div style=\"text-align: left;\"><span style=\"font-family: Tahoma; font-size: medium;\"><br \/>Now, I knew I&#8217;d seen it before, and sure enough, Stack Overflow had quite a lot of questions about it. But I&#8217;d seen them before. And then I remembered that I never found out why the problem went away before.<\/span><\/div>\n<div style=\"text-align: left;\"><span style=\"font-family: Tahoma; font-size: medium;\"><br \/>As an experiment, I tried something that I thought couldn&#8217;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.<\/span><\/div>\n<div style=\"text-align: left;\"><span style=\"font-family: Tahoma; font-size: medium;\"><br \/><\/span><\/div>\n<div style=\"text-align: left;\"><span style=\"font-family: Tahoma; font-size: medium;\">At a guess, the camera startup can&#8217;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.<\/span><\/div>\n<div style=\"text-align: left;\"><span style=\"font-family: Tahoma; font-size: medium;\"><br \/><\/span><\/div>\n<div style=\"text-align: left;\"><span style=\"font-family: Tahoma; font-size: medium;\">It&#8217;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&#8217;s my guess&#8230;<\/span><\/div>\n<div style=\"text-align: left;\"><span style=\"font-family: Tahoma; font-size: medium;\"><br \/><\/span><\/div>\n<div style=\"text-align: left;\"><span style=\"font-family: Tahoma; font-size: medium;\">#MMALresources<\/span><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;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&#8217;d seen it before, and sure enough, Stack Overflow had quite a lot of questions about it. &hellip; <a href=\"https:\/\/doctor-dark.co.uk\/blog\/python-on-raspberry-pi-a-note-about-structure-or-something\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Python on Raspberry Pi, a note about structure, or something.&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-127","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts\/127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=127"}],"version-history":[{"count":1,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts\/127\/revisions"}],"predecessor-version":[{"id":331,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts\/127\/revisions\/331"}],"wp:attachment":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}