Menu

#20 scan one and exit

version_0.9
closed
spadix
7
2009-10-23
2009-10-15
Natim
No

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 ?

Discussion

  • spadix

    spadix - 2009-10-15

    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

     
  • spadix

    spadix - 2009-10-15
    • status: open --> pending
     
  • Natim

    Natim - 2009-10-19

    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

     
  • Natim

    Natim - 2009-10-19
    • status: pending --> open
     
  • Natim

    Natim - 2009-10-19

    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.

     
  • spadix

    spadix - 2009-10-20

    > 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

     
  • spadix

    spadix - 2009-10-20
    • priority: 5 --> 7
     
  • Nobody/Anonymous

    I build from the mercurial repository.
    It still doesn't print anything.

    Thank you spadix :)

     
  • spadix

    spadix - 2009-10-21

    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

     
  • spadix

    spadix - 2009-10-21
    • status: open --> pending
     
  • spadix

    spadix - 2009-10-21

    scanone.py

     
  • spadix

    spadix - 2009-10-21

    note, pushed minor bug fix (rev a25c5b96c3ce), also added read_one.py (and .pl) under examples

     
  • Natim

    Natim - 2009-10-23

    Ok, I works perfectly

     
  • Natim

    Natim - 2009-10-23
    • status: pending --> open
     
  • spadix

    spadix - 2009-10-23

    great, thanks for the verification

     
  • spadix

    spadix - 2009-10-23
    • status: open --> closed
     
  • Nobody/Anonymous

    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 :)

     
  • spadix

    spadix - 2009-10-28

    zbarcam never used a -s option? ...a new feature request would be the appropriate place to request new functionality

     

Log in to post a comment.

MongoDB Logo MongoDB