I am trying with Python and C to just parse one barcode and exit without having to press the q or Q key.
If I am using process_one, I don't have a result.
It seams that some thead are still running and don't want to quit. even using sys.exit(0) ok del proc.
Any help ?
there were a few problems in 0.9 that should be fixed in the latest code. if you can try this out from hg, it should resolve the hang you are experiencing. (fwiw- the next release will be very soon)
thanks for reporting this,
-spadix
Here is the code to test :
#!/usr/bin/python
from sys import argv, exit
import zbar
# create a Processor
proc = zbar.Processor()
# configure the Processor
proc.parse_config('enable')
# initialize the Processor
device = '/dev/video0'
if len(argv) > 1:
device = argv[1]
proc.init(device)
# setup a callback
def my_handler(proc, image, closure):
# extract results
for symbol in image:
if not symbol.count:
# do something useful with results
print symbol.type, ':', '%s' % symbol.data
proc.set_data_handler(my_handler)
# enable the preview window
proc.visible = True
# initiate scanning
proc.active = True
try:
proc.process_one()
except zbar.WindowClosed:
pass
It still doesn't work.
I hope, I am using the last version
>>> print zbar.__doc__
None
>>> zbar.__package__
>>> zbar.version
<built-in function version>
Could you also fix this, to show the version of zBar so we could be sure.
> I hope, I am using the last version
>
did you build from a clone of the mercurial repository?
> It still doesn't work.
>
not sure exactly what that means? it is still hanging? or it just does not print anything?
this current "process one" API leaves a lot to be desired. let me make some updates and provide you with a better test, then we can see if you need something more than that
-spadix
I build from the mercurial repository.
It still doesn't print anything.
Thank you spadix :)
ok, update to the latest (rev 112fd7233b01) and try this new test (attached) - i think it will better match both our expectations :)
let me know if you still have problems...
thanks!
-spadix
scanone.py
note, pushed minor bug fix (rev a25c5b96c3ce), also added read_one.py (and .pl) under examples
Ok, I works perfectly
great, thanks for the verification
In the new 0.10 version there is no more -s option for zbarcam. I could be good to add it with the working process_one function :)
zbarcam never used a -s option? ...a new feature request would be the appropriate place to request new functionality