catch zbar import error
This commit is contained in:
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -25,11 +25,11 @@ jobs:
|
|||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install zbar lib for QReader (Linux)
|
- name: Install zbar shared lib for QReader (Linux)
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: |
|
run: |
|
||||||
# FIXME sudo apt-get install -y libzbar0
|
# FIXME sudo apt-get install -y libzbar0
|
||||||
- name: Install zbar lib for QReader (macOS)
|
- name: Install zbar shared lib for QReader (macOS)
|
||||||
if: runner.os == 'macOS'
|
if: runner.os == 'macOS'
|
||||||
run: |
|
run: |
|
||||||
brew install zbar
|
brew install zbar
|
||||||
|
|||||||
4
.github/workflows/nightly.yml
vendored
4
.github/workflows/nightly.yml
vendored
@@ -23,11 +23,11 @@ jobs:
|
|||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install zbar lib for QReader (Linux)
|
- name: Install zbar shared lib for QReader (Linux)
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install -y libzbar0
|
sudo apt-get install -y libzbar0
|
||||||
- name: Install zbar lib for QReader (macOS)
|
- name: Install zbar shared lib for QReader (macOS)
|
||||||
if: runner.os == 'macOS'
|
if: runner.os == 'macOS'
|
||||||
run: |
|
run: |
|
||||||
brew install zbar
|
brew install zbar
|
||||||
|
|||||||
@@ -187,7 +187,10 @@ def convert_img_to_line(filename):
|
|||||||
abort('\nERROR: Unable to open file for reading.\ninput file: {}'.format(filename))
|
abort('\nERROR: Unable to open file for reading.\ninput file: {}'.format(filename))
|
||||||
|
|
||||||
# dynamic import of QReader since this module has a dependency to zbar lib
|
# dynamic import of QReader since this module has a dependency to zbar lib
|
||||||
from qreader import QReader
|
try:
|
||||||
|
from qreader import QReader
|
||||||
|
except ImportError as e:
|
||||||
|
abort('\nERROR: Cannot import QReader module probably due to missing zbar shared library. Exception:\n{}'.format(str(e)))
|
||||||
|
|
||||||
decoder = QReader()
|
decoder = QReader()
|
||||||
decoded_text = decoder.detect_and_decode(image=image)
|
decoded_text = decoder.detect_and_decode(image=image)
|
||||||
|
|||||||
Reference in New Issue
Block a user