Decoding on MacOS gives raw data
See original GitHub issueHi,
Executing the following code gives me unexpected results on MacOS:
from pystrich.datamatrix import DataMatrixEncoder
import PIL
from io import BytesIO
from pylibdmtx.pylibdmtx import decode
data = 'SomeStringWithData'
print(f'Encoding: {data}')
image_bytes = DataMatrixEncoder(data).get_imagedata(cellsize=2)
image = PIL.Image.open(BytesIO(image_bytes))
results = decode(image)
print('raw results:')
print(results)
Output on MacOS 10.13.3
:
Encoding: SomeStringWithData
raw results:
[Decoded(data=b'TpnfTusjohXjuiEbub\xb9AE\xbf}\xad|\xc81\xda\x9d\x9a\x95\xb2`\xf7`\x07\x01', rect=Rect(left=3, top=4, width=37, height=35))]
Whereas this works as expected on both Linux and Windows.
Basically it gives the raw data of the datamatrix instead of the parsed/decoded one.
I can’t figure out whats going on because:
dmtxread
fromdmtx-utils
DOES work on the same machine, suggesting the c library IS NOT at fault here- the
dmtxDecodeMatrixRegion
wrapper function gives the wrong result, suggesting the c library IS at fault.
I’ve also tried having the latest version of libdmtx
compiled from source on my search path instead of the one from homebrew
but it gives the same result.
Is this a known issue on your end maybe?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Cannot decode raw data “download problem”
I've updated and restarted my Mac, checked network, & retried multiple times. I also switched the destination, and allowed unrecognized sites ...
Read more >Safari - cannot decode raw data - Help & Support
Hi everyone, some of my users report they get an "cannot decode raw data" error when they try to access my new 4.5...
Read more >eidenv -p work but with segmentation fault on macOS #1220
We try to get informations from Belgium eid cards by using eidenv -p . The result is quite good as it displays all...
Read more >Download X Lossless Decoder for Mac | MacUpdate
X Lossless Decoder(XLD) is a tool for Mac OS X that is able to decode/convert/play various 'lossless' audio files. The supported audio files ......
Read more >macOS Command - "base64" - Herong's Tutorial Examples
Data Encoding Tutorials - Herong's Tutorial Examples. ∟Base64 Encoding and Decoding Tools. ∟macOS Command - "base64". This section provides a tutorial ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Included in v.0.1.8, now on PyPI.
I have investigated a little more deeply and have come to the following conclusions:
Evidence
This is not a platform independent bug
I have managed to replicate this problem on my machine (Debian testing) with the
apt install
ed libdmtx (v0.7.5), as has @akhmerov.This is a problem with pylibdmtx
I used the first part of @justinvdk’s script above to generate a problematic datamatrix. I then saved this to a PNG file and read it in using the
dmtxread
program installed withapt
, which is linked against libdmtx v0.7.5, and it produces the correct result.What’s the problem
I believe that the API to libdmtx has changed between 2 bugfix releases, when really there should have been a minor (or even major) version release.
I used the shell script from this gist with
git bisect
in the libdmtx repo to find that this commit is where things stopped working. I notice that this commit actually changed the API of libdmtx by adding extra fields to some of the exported datastructures. This means that the wrappers inwrapper.py
are formally incorrect, and things break in unexpected ways.’