Comments (4)
I had the same problem (I'm also on Windows). I got the package through pip and I saw that there are some differences in __init__.py
compared to the one on github.
My downloaded __init__.py
had in the decode
method:
file_uri = 'file://' + quote(os.path.abspath(filename))
While on github it looks like this (link):
file_uri = pathlib.Path(filename).absolute().as_uri()
The version on github worked for me.
file_uri
variable value in 1st case: file://D%3A%5Czxing_test%5Cimage.jpg
file_uri
variable value in 2nd case: file:///D:/zxing_test/image.jpg
Maybe something needs to be updated on pypi?
from python-zxing.
from python-zxing.
Hmmm… I don't know either. The zxing Java binary is notably terrible at parsing the filenames sent to it by Python (it's possible that the Chinese characters in the path are confusing it). The fact that you're running on Windows doesn't help…
Can you try adding these two lines and re-running? It should print two extra lines with the filename and “file URI” before failing.
diff --git a/zxing/__init__.py b/zxing/__init__.py
index bd0dd31..c767f0a 100644
--- a/zxing/__init__.py
+++ b/zxing/__init__.py
@@ -58,7 +58,9 @@ class BarCodeReader(object):
elif stdout.startswith(b'''Exception in thread "main" java.io.IOException: Could not load '''):
raise BarCodeReaderException("Java library could not read image; is it in a supported format?", filename)
elif stdout.startswith(b'''Exception '''):
+ print(filename)
+ print(file_uri)
raise BarCodeReaderException("Unknown Java exception: %s" % stdout)
elif p.returncode:
raise BarCodeReaderException("Unexpected subprocess return code %d" % p.returncode, self.java)
from python-zxing.
The version on github worked for me.
I appreciate the feedback about the working change, but your way of demonstrating the difference is a little excruciating. 😓
A simple git log v0.10..HEAD
will show you that we changed this in 06ce16c.
Maybe something needs to be updated on pypi?
Indeed. The aforementioned changes haven't yet been rolled into a release.
Update: Done. Latest version tagged as v0.11
and pushed to PyPI.
from python-zxing.
Related Issues (20)
- Cannot install from tarball HOT 1
- Command-line interface HOT 4
- data matrix generator HOT 1
- Fix TravisCI test failure for python 3.7, 3.8
- read multiple barcodes? HOT 3
- raw and parsed decode compatibility with ZXing HOT 5
- Use jpype for wrapper? HOT 2
- how to get rawByte from qr code? HOT 2
- How to input image array instead of filename to read QR code? HOT 3
- utf-8 codec decoding error HOT 3
- How to get QR Code version, error correction level, and mask? HOT 4
- Can't find the code when there are other content in the image HOT 1
- Different results from online decoder HOT 2
- ZXing does not decode some QR images HOT 2
- UnboundLocalError: local variable 'bc' referenced before assignment HOT 4
- Issues in decoding PDF 417 format Barcodes HOT 2
- Can't install ZXing - FileNotFoundError "requirements.txt" HOT 13
- Install fails on Windows
- Fails when passing pathlib.Path object HOT 1
- Insufficient handling of missing result in BarCode.__repr__ HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-zxing.