User Tools

Site Tools


python:barcode

This is an old revision of the document!


Python Barcode

huBarcode

Setup huBarcode

  1. step1: download hubarcode from https://github.com/hudora/huBarcode
  2. step2: install python processing image:
    pip uninstall PIL
    pip install pillow
  3. step2: build and install hubarcode:
    python setup.py build
    python setup.py install

Example create Barcode with hubarcode

Create Firt example barcode.py and run it:

  1. Step1: Create barcode.py
    import sys
    from hubarcode.code128 import Code128Encoder
    if __name__ == '__main__':
        print 'barcode generator'
        encoder = Code128Encoder(sys.argv[1])
        encoder.save("test.png")
  2. Step2: Run it:
    python barcode.py 123

    Not run:

    barcode.py 123

    Because it generate error:

    ImportError: No module named Image
python/barcode.1470613232.txt.gz · Last modified: 2022/10/29 16:15 (external edit)