Hardware used: Raspberry pi 4b, 4 gb ram, AMG8833 thermal camera, PiCamera V2 noir, ALL brand new, i just bought them few weeks ago.

Im trying to do finish a project and i ran into a not that good error, i couldnt find anything on the internet till now!

This is the main code that i m trying to use and ther eis the errors that i get.

This is the PiCamera simple code.

Blob detection code that is super ok, it works but it uses the image from the picamera

If the picamera does not get a capture the blob detection algorithm gets the same image from the last time... and it s not that nice.

And the AMG8833 code is the adafruit version that i changed with a simple while (1) loop so it can run and update continuously.

Ok, the question is: Why do i keep getting that error only when it is in main code and when i test it in the normal folder i wont get any error and it works perfectly?

I tried with a while loop and it gives me the same error and then i tried a simple version and it worked. Same in the main code - i used it in the while 1 loop and it gives me the error from the first image and then i deleted it from the while loop and dropped it outside the while loop and the problem seems to be from the while loop, but i still dont know yet... what is the problem.

I would like to see some answers from more experienced guys, i only have like... 2 weeks in programming and raspberry pi..


  • Please don't post your code as pictures. Post it in a CODE block as plain text (with appropriate formatting if it's python).
    – Dougie
    May 15, 2021 at 16:49
  • Ok, sorry, i didnt know how to use it for the first time.. Thank you for your advice!! May 17, 2021 at 4:25

1 Answer 1


FOR anyone that is in need for this information

just add camera.close() method at the final of this program and it should work, because you use 2 cameras, AMG8833 and PiCamera, you cand use only one at a time, thats why you have to close the process! Good day!

  • AFAICT the problem was actually that you keep initialising the pi camera on every call; not the fact that you are using 2 sensors. Normally you would only call camera=PiCamera() once. ENOSPC seems to confirm that.
    – Dirk
    May 15, 2021 at 5:41
  • Thank you for the answer! How should the code look like so it wont call it multiple times? May 15, 2021 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.