Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

安装成功但测试运行失败 #33

Open
urnotlxr opened this issue Mar 2, 2022 · 3 comments
Open

安装成功但测试运行失败 #33

urnotlxr opened this issue Mar 2, 2022 · 3 comments

Comments

@urnotlxr
Copy link

urnotlxr commented Mar 2, 2022

``你好,我在按README.md安装pyzxing的时候遇到了一些问题。
首先是运行测试脚本
python -m unittest tests.test_decode
得到了如下结果: FAILED (failures=2, errors=6)

Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
EException in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
EException in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
EException in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
FException in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
FException in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
E.Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
EException in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
E
======================================================================
ERROR: test_codabar (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 16, in test_codabar
    self.assertEqual(result[0]['parsed'], gt)
IndexError: list index out of range

======================================================================
ERROR: test_code128 (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 30, in test_code128
    self.assertEqual(result[0]['parsed'], gt)
IndexError: list index out of range

======================================================================
ERROR: test_code39 (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 23, in test_code39
    self.assertEqual(result[0]['parsed'], gt)
IndexError: list index out of range

======================================================================
ERROR: test_nobarcodefile (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 59, in test_nobarcodefile
    self.assertEqual(result[0].get('parsed', None), None)
IndexError: list index out of range

======================================================================
ERROR: test_pdf417 (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 37, in test_pdf417
    self.assertEqual(result[0]['parsed'], gt)
IndexError: list index out of range

======================================================================
ERROR: test_qrcode (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 44, in test_qrcode
    self.assertEqual(result[0]['parsed'], gt)
IndexError: list index out of range

======================================================================
FAIL: test_multibarcodes (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 69, in test_multibarcodes
    self.assertEqual(set(result_string), set(gt))
AssertionError: Items in the second set but not the first:
b'201541368446'
b'201541371885'
b'201541332863'
b'201541332768'
b'201541395223'
b'201541350294'
b'201541393029'

======================================================================
FAIL: test_multifiles (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 86, in test_multifiles
    self.assertEqual(set(results_string), set(gt))
AssertionError: Items in the second set but not the first:
b'31117013206375'
b'[)>\x1e01\x1d96123450000\x1d222\x1d111\x1dMODE2'
b'-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
b'When we at WRT talk about \\"text,\\" we are generally talking about a particular kind of readable information encoding - and readable is a complex proposition. Text may be stylized in a way we are unfamiliar with, as in blackletter - it may be interspersed with some markup we don\\\'t understand, such as HTML - it may be be a substitution system we aren\\\'t familiar with, such as braille or morse code - or it may be a system that, while technically human-readable, isn\\\'t particularly optimized for reading by humans, as with barcodes (although barcodes can be read).'
b'TEST-SHEET'
b'8101054321120021123456'

----------------------------------------------------------------------
Ran 9 tests in 5.651s

FAILED (failures=2, errors=6)

之后我运行了如下指令


git submodule init
git submodule update
cd zxing
mvn install -DskipTests

得到输出


……

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for ZXing 3.4.1-SNAPSHOT:
[INFO] 
[INFO] ZXing .............................................. SUCCESS [ 21.216 s]
[INFO] ZXing Core ......................................... SUCCESS [ 43.372 s]
[INFO] ZXing Java SE extensions ........................... FAILURE [  4.195 s]
[INFO] ZXing zxing.org web app ............................ SKIPPED
[INFO] ZXing Appspot-based encoder ........................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:09 min
[INFO] Finished at: 2022-03-02T16:20:19+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.13:check (default) on project javase: Too many files with unapproved license: 1 See RAT report in: /media/lappy/文档/cv-practice/ZXing/pyzxing/zxing/javase/target/rat.txt -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :javase


再接着运行


cd javase
mvn -DskipTests package assembly:single

得到输出

……

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.526 s
[INFO] Finished at: 2022-03-02T16:21:33+08:00
[INFO] ------------------------------------------------------------------------

运行示例代码,报错


Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
	at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
[]


我对没有了解过Java和maven,请问我该如何解决遇到的问题?

@ChenjieXu
Copy link
Owner

ChenjieXu commented Mar 8, 2022

您好,和您确认下您的运行环境和软件版本,您使用的是否是Linux系统,使用的是哪个版本的pyzxing程序?
我看您是通过build得到的jar包,在zxing/javase/target目录下是否有jar文件?
如果找到了请运行java -jar “jar文件地址” “需要识别的图片地址”,并将打印出的信息反馈给我。

@QLW-07
Copy link

QLW-07 commented Dec 7, 2022

你好,我使用的Linux系统,编译得到的pyzxing版本是1.0.2b0

bulid得到的jar包,运行如下:
(pyzxing) xt@xt:/pyzxing/zxing$ java -jar ./javase/target/javase-3.4.1-SNAPSHOT.jar 1.jpg
./javase/target/javase-3.4.1-SNAPSHOT.jar中没有主清单属性
(pyzxing) xt@xt:
/pyzxing/zxing$ java -jar ./javase/target/gwt-user-2.8.2.jar 1.jpg
Error: Invalid or corrupt jarfile ./javase/target/gwt-user-2.8.2.jar
(pyzxing) xt@xt:/pyzxing/zxing$ java -jar ./javase/target/javase-3.4.1-SNAPSHOT-javadoc.jar 1.jpg
./javase/target/javase-3.4.1-SNAPSHOT-javadoc.jar中没有主清单属性
(pyzxing) xt@xt:
/pyzxing/zxing$ java -jar ./javase/target/javase-3.4.1-SNAPSHOT-sources.jar 1.jpg
./javase/target/javase-3.4.1-SNAPSHOT-sources.jar中没有主清单属性

运行脚本后报错提示依然情况如下:
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)

@IllBthere4U
Copy link

您好,请问您解决了么?我也遇到了相同的状况。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants