OSError: Failed to write requested bytes!

Discussion related to "under the hood" OpenMV topics.
User avatar
kikiorg
Posts: 4
Joined: Wed Jan 24, 2018 6:09 pm

OSError: Failed to write requested bytes!

Postby kikiorg » Mon Feb 05, 2018 6:11 pm

The camera works with the helloworld_1.py. Now I want to snap then save images. I added this code, but get the above message:

Code: Select all

img = sensor.snapshot()         # Take a picture and return the image.
file_name = "test.bmp"
img.save(file_name)
The image displays in the IDE, so the image is coming over USB serial, but does image.save() save locally or on my Mac? Since the full path on my Mac as well as paths like "~/" aren't working I assume it's trying to save locally. I would think that should work.

Note, if I add (roi=Auto) I get the error "NameError: name 'Auto' is not defined."

Any ideas?
User avatar
kwagyeman
Posts: 1941
Joined: Sun May 24, 2015 2:10 pm

Re: OSError: Failed to write requested bytes!

Postby kwagyeman » Mon Feb 05, 2018 6:42 pm

You need an SD card with your camera. The internal flash drive is only 96kb which can't handle an image.

As for the roi=Auto, that just means the default ROI is the whole image. If you want to save something smaller pass an ROI rectangle tuple (x,y,w,h).
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests