1

I try to run this code

import pyqrcode
from qrtools import qrtools
from PIL import Image
import zbar
qr = pyqrcode.create("She got two litle horns and they get me a litle bit")
qr.png("horn.png", scale=6)
qr = qrtools.QR()
scanner = zbar.Scanner()
qr.decode("horn.png")
print(qr.data)

And it says to me

AttributeError: module 'zbar' has no attribute 'ImageScanner'

Im running the latest ubuntu x64 and have all dependencies installed mayby is because im trying on python3

Ben
  • 27
  • 1
  • 7

1 Answers1

0

Apparently you have to use python2 and install zbar with ubuntu package manager

sudo apt-get install python-zbar

I tested it on my Ubuntu 17.10 machine and it worked with python2. Python3 doesn't seem to work though, see here, they have the same issue: Can't install zbar

Make sure you are running the right python version by typing this in the terminal:

 python --version

It has to say: Python 2.7.X where X is 14 on my machine