3

I'm using zbar with python on a raspberry pi to scan barcodes, using the raspicam. (Well I'm attempting to!) The first time I run my python program, it works fine, however, after that, any subsequent runs will fail, and in order for the program to work I must reboot. The error message is

error: Invalid argumentfd: 5
zbar.SystemError: ERROR: zbar processor in v412_nq():
   system error: queuing video buffer (VIDIOC_QBUF): No such device (19)

and my python code is:

import zbar

proc = zbar.Processor() #create processor
proc.parse_config('enable') #enable processor
proc.init('/dev/video0',False) #initialise processor, without outputting a display

for n in [1,2,3]:
    proc.process_one() #wait for a barcode to be read
    for symbol in proc.results:
        print symbol.data

I used uv4l to get the raspicam to appear at /dev/video0

Any help with how I can debug this would be greatly appreciated!

1

I do not have uv4l and also did not install zbar so this answer is just a guess

/dev/video0 is (probably) locked the first time you run proc.init('/dev/video0', False) and the lock is not released when the program exits. This is (probably) why the program only works once every reboot.


To check if i am right, use lsof | grep /dev/video0

If i am wrong, please leave a comment to let me know.

If i am right, you can try umount /dev/video0 or kill <pid> to try and release the lock.
And also leave a comment to let others know

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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