NaturalHistoryMuseum / pyzbar

Read one-dimensional barcodes and QR codes from Python 2 and 3.
MIT License
728 stars 176 forks source link

Cannot remove WARNING: messages from output #96

Open gozooit opened 3 years ago

gozooit commented 3 years ago

Hi,

I'm trying to list all the codebar data from large files, and I want a clean output. However, I keep getting WARNING: messages and I can't find a way to get rid of them. I saw this similar issue (29) but the resolution didn't work for me.

The warning messages I get (which I don't really understand to be honest) :

WARNING: .\zbar\decoder\pdf417.c:89: <unknown>: Assertion "g[0] >= 0 && g[1] >= 0 && g[2] >= 0" failed.
    dir=1 sig=9d9b k=0 g0=217 g1=47d g2=ffffffff buf[0000]=
WARNING: zbar\decoder\databar.c:1250: <unknown>: Assertion "seg->finder >= 0" failed.
    i=10 f=-1(000) part=1

The fixes I tried :

import os
import sys
import warnings

warnings.filterwarnings('ignore')

f = open(os.devnull, 'w')
sys.stderr = f

decoded_objects = decode(Image.open(tiff), symbols=[ZBarSymbol.CODE128])

None of them worked. Is there any way to have a clean output ? I'm running out of solutions..

gozooit commented 2 years ago

Hi,

No, unfortunately I did not..

Regards.

------- Original Message ------- Le samedi 7 mai 2022 à 9:56 PM, Luca Berhard @.***> a écrit :

Have you found a solution to it by any chance?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>