Pyinstaller: PyQt5 Cannot read QLibraryInfo output: raised Expecting value: line 1 column 1 (char 0) when decoding

Created on 8 Jan 2019  Â·  1Comment  Â·  Source: pyinstaller/pyinstaller

What do you get when you execute

import json
from PyQt5.QtCore import QLibraryInfo

paths = [x for x in dir(QLibraryInfo) if x.endswith('Path')]
location = {x: QLibraryInfo.location(getattr(QLibraryInfo, x))
            for x in paths}
try:
    version = QLibraryInfo.version().segments()
except AttributeError:
    version = None
print(str(json.dumps({
    'isDebugBuild': QLibraryInfo.isDebugBuild(),
    'version': version,
    'location': location,
})))

on your PC?

_Originally posted by @bjones1 in #3551 (comment)_

the output of the scripts is:

{"isDebugBuild": false, "version": null, "location": {"ArchDataPath": "/usr/lib/x86_64-linux-gnu/qt5", "LibraryExecutablesPath": "/usr/lib/x86_64-linux-gnu/qt5/libexec", "SettingsPath": "/etc/xdg", "PluginsPath": "/usr/lib/x86_64-linux-gnu/qt5/plugins", "ImportsPath": "/usr/lib/x86_64-linux-gnu/qt5/imports", "LibrariesPath": "/usr/lib/x86_64-linux-gnu", "BinariesPath": "/usr/lib/x86_64-linux-gnu/qt5/bin", "DataPath": "/usr/share/qt5", "TranslationsPath": "/usr/share/qt5/translations", "HeadersPath": "/usr/include/x86_64-linux-gnu/qt5", "PrefixPath": "/usr", "Qml2ImportsPath": "/usr/lib/x86_64-linux-gnu/qt5/qml", "DocumentationPath": "/usr/share/qt5/doc", "TestsPath": "/usr/tests", "ExamplesPath": "/usr/lib/x86_64-linux-gnu/qt5/examples"}}

the version is Null, but others seems right。

The exception message is as follows:

24614 INFO: Loading module hooks...
24614 INFO: Loading module hook "hook-PyQt5.QtSvg.py"...
24846 WARNING: Cannot read QLibraryInfo output: raised Expecting value: line 1 column 1 (char 0) when decoding:
Traceback (most recent call last):
File "", line 11, in
TypeError: __call__() got an unexpected keyword argument 'qualname'
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 11, in
load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/__main__.py", line 111, in run
run_build(pyi_config, spec_file, *vars(args))
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, *
kwargs)
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/building/build_main.py", line 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/building/build_main.py", line 784, in build
exec(text, spec_namespace)
File "", line 17, in
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/building/build_main.py", line 241, in __init__
self.__postinit__()
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
self.assemble()
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/building/build_main.py", line 500, in assemble
module_hook.post_graph()
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/building/imphook.py", line 410, in post_graph
self._load_hook_module()
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/building/imphook.py", line 377, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/compat.py", line 736, in importlib_load_source
return mod_loader.load_module()
File "", line 388, in _check_name_wrapper
File "", line 809, in load_module
File "", line 668, in load_module
File "", line 268, in _load_module_shim
File "", line 693, in _load
File "", line 673, in _load_unlocked
File "", line 665, in exec_module
File "", line 222, in _call_with_frames_removed
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/hooks/hook-PyQt5.QtSvg.py", line 11, in
hiddenimports, binaries, datas = add_qt5_dependencies(__file__)
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/utils/hooks/qt.py", line 514, in add_qt5_dependencies
more_binaries = qt_plugins_binaries(plugin, namespace=namespace)
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/utils/hooks/qt.py", line 132, in qt_plugins_binaries
pdir = qt_plugins_dir(namespace=namespace)
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/utils/hooks/qt.py", line 95, in qt_plugins_dir
paths = [pyqt5_library_info.location['PluginsPath']]
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/utils/hooks/qt.py", line 67, in __getattr__
qli = json.loads(json_str)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Most helpful comment

It seems that 'exec_statement' function throws an exception. I fix it by replacing the function to direct json str result.
At /usr/local/lib/python3.5/dist-packages/PyInstaller/utils/hooks/qt.py line: 41
json_str = '{"isDebugBuild": false, "version": [5, 11, 2], "location": {"ArchDataPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "LibraryExecutablesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/libexec", "Qml2ImportsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/qml", "ExamplesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/examples", "DocumentationPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/doc", "PluginsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/plugins", "LibrariesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/lib", "ImportsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/imports", "HeadersPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/include", "TranslationsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/translations", "SettingsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "PrefixPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "DataPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "TestsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/tests", "BinariesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/bin"}}'

>All comments

It seems that 'exec_statement' function throws an exception. I fix it by replacing the function to direct json str result.
At /usr/local/lib/python3.5/dist-packages/PyInstaller/utils/hooks/qt.py line: 41
json_str = '{"isDebugBuild": false, "version": [5, 11, 2], "location": {"ArchDataPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "LibraryExecutablesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/libexec", "Qml2ImportsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/qml", "ExamplesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/examples", "DocumentationPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/doc", "PluginsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/plugins", "LibrariesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/lib", "ImportsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/imports", "HeadersPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/include", "TranslationsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/translations", "SettingsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "PrefixPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "DataPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "TestsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/tests", "BinariesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/bin"}}'

Was this page helpful?
0 / 5 - 0 ratings