openpreserve / jpylyzer

JP2 (JPEG 2000 Part 1) validator and properties extractor. Jpylyzer was specifically created to check that a JP2 file really conforms to the format's specifications. Additionally jpylyzer is able to extract technical characteristics.
http://jpylyzer.openpreservation.org/
Other
69 stars 28 forks source link

Windows binaries give import error #102

Closed bitsgalore closed 6 years ago

bitsgalore commented 6 years ago

After installing Windows binaries for 1.18.0b5 on Wine, the following error is reported after launch:

Traceback (most recent call last):
  File "jpylyzer\jpylyzer.py", line 49, in <module>
  File "C:\Python27_64\python-2.7.13.amd64\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
    exec(bytecode, module.__dict__)
  File "jpylyzer\etpatch.py", line 24, in <module>
ImportError: No module named byteconv
Failed to execute script jpylyzer

Check on proper windows machine, looks like the old relative import problem rearing its ugly head again.

ALSO check if this problem occurs with the pip install om Windows.

bitsgalore commented 6 years ago

Import problems with binaries are fixed by https://github.com/openpreserve/jpylyzer/commit/cba3201f0272e5b52bf34119e0a4cbf46f8afb4b

Solution was to import module as a whole instead of individual functions/classes. Not entirely sure why this even works.

TODO:

  1. Figure out how to do relative imports properly, as I end up with import errors when I follow PEP 328 - either I'm not understanding PEP 328 correctly or perhaps there's something unusual in the way jpylyzer's submodules are organised.
  2. Test if this also solves the Pip problem on Windows (still doesn't work under Wine but this may have other causes. Strangely the isolyzer package, which uses a similar packaging process, can be used under Wine without any issues)

Additional resources on import issues

bitsgalore commented 6 years ago

Update: modified imports / structure according to links mentioned above: https://github.com/openpreserve/jpylyzer/tree/test-structure

This creates 2 new problems:

bitsgalore commented 6 years ago

Following changes fix all of the above issues (cli.py is now compilation target and can be used as convenience wrapper also) https://github.com/openpreserve/jpylyzer/commit/4dcd726abb5b55514c2e5947275cfa28eac6eef0