如何将条形码阅读器和拇指印象认证设备与我的Plone网站集成?

时间:2015-11-06 17:39:23

标签: python plone zbar plone-3.x

我使用zbar python模块集成条形码阅读器,但无法为我的代码打开视图:

#!/usr/bin/python
from sys import argv
import zbar
from PIL import Image
import io
import time
import picamera

class BarCodeScan(BrowserView):
   def __call__(self):
    if len(argv) < 2: exit(1)

    # create a reader
    scanner = zbar.ImageScanner()

    # configure the reader
    scanner.parse_config('enable')

    # obtain image data
    pil = Image.open(argv[1]).convert('L')
    width, height = pil.size
    raw = pil.tostring()

    # wrap image data
    image = zbar.Image(width, height, 'Y800', raw)

    # scan the image for barcodes
    scanner.scan(image)

    # extract results
    for symbol in image:
        # do something useful with results
        print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data

    # clean up
    del(image)

它出现以下错误:

  

OSError:libmmal.so:无法打开共享对象文件:没有这样的文件或目录

0 个答案:

没有答案