Page 1 of 1

ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Posted: Tue Dec 24, 2019 1:38 pm
by megil
Hello everyone,

I have a problem.

I get this error when running 1_test.py in tutorial;
ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

"raspistill -cs 0" - OK
"raspistill -cs 1" - OK

Can you help me?

Thanks.

Re: ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Posted: Tue Dec 24, 2019 1:49 pm
by Realizator
Hi Megil,
As a rule, such an errors appears if you're installing our tutorial scripts on a Raspbian with a newer Python or OpenCV version.

Solutions:
1. [recommended] Use the latest code and Raspbian image. This is Buster-based image and a code from this repo: https://github.com/realizator/stereopi-fisheye-robot
You can find downloads link in this repository description file.

(JFYI: This is updated version of older "https://github.com/realizator/stereopi-tutorial" code)

2. You can use previous code https://github.com/realizator/stereopi-tutorial and appropriate Stretch image

3. If you're advanced user, you can prepare appropriate Raspbian image by installing OpenCV as mentioned in this guide.

UPD> According to your another post on our forum, I can suggest you're using Ubuntu Mate. In this case it is better to follow step 3.

Re: ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Posted: Tue Dec 24, 2019 2:00 pm
by megil
I'm using Ubuntu-Mate.

The codes I use are the latest in your github repository.

Re: ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Posted: Tue Dec 24, 2019 2:49 pm
by Realizator
megil wrote:
Tue Dec 24, 2019 2:00 pm
I'm using Ubuntu-Mate.

The codes I use are the latest in your github repository.
Okay.
1. Which repository you're using now?
2. For our python codes you need to use python3. In our image we've tuned system, so running "python 1_test.py" actually runs python3, that is "python3 1_test.py". Have you tried to run "python3" instead of "python"?

Re: ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Posted: Tue Dec 24, 2019 3:17 pm
by megil
I tried it with python3 but it didn't work.

I think I have a bug related to numpy, I used PiRGBArray instead of numpy. I solved the problem.

Thanks.

Re: ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Posted: Tue Dec 24, 2019 3:49 pm
by Realizator
It's great that you've solved your issue! :-)