I had an issue with Qt libraries issues when calling LabRecorder as a subprocess from python.
When using subprocess.Popen(), the current os.environ variables are passed along.
Unfortunately LabRecorder seems to first lookup Qt libraries in the PATH rather than use those carried on during compilation.
To solve the issue, I manually remove them from the environment
import os
from subprocess import Popen, PIPE
# we need to strip the PATH variable of any pyqt reference passed on when opening the pipe!
env_dict = dict(copy.deepcopy(os.environ))
pth = env_dict.get("PATH")
pth = ";".join([s for s in pth.split(";") if s.lower().find("pyqt") < 0]) # remove qt
print(f"new path without qt: {pth}")
for key, val in env_dict.items():
print(f"{key}: {val}")
# here are the culprit that breaks qt from working on the called executable
if "QT_PLUGIN_PATH" in env_dict.keys():
del env_dict["QT_PLUGIN_PATH"]
if "QML2_IMPORT_PATH" in env_dict.keys():
del env_dict["QML2_IMPORT_PATH"]
Then I can call the subprocess with the altered environment variables
I had an issue with Qt libraries issues when calling LabRecorder as a subprocess from python.
When using
subprocess.Popen()
, the currentos.environ
variables are passed along.Unfortunately LabRecorder seems to first lookup Qt libraries in the PATH rather than use those carried on during compilation. To solve the issue, I manually remove them from the environment
Then I can call the subprocess with the altered environment variables
Here is the fix, in case nothing can be done :)