- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 159
 
Description
Example scenario: A python process with only PySide6 in its sys.path imports qtpy, which causes the QT_API environment variable to be automatically set to "pyside6". A different version of python is launched as a subprocess (inheriting the QT_API environment variable), which has only PySide2 in its sys.path. When the child process tries to import qtpy, an exception is raised:
qtpy.QtBindingsNotFoundError: No Qt bindings could be found
This happens because "pyside6" appears after "pyside2" in the fallback sequence, so no attempt is ever made to import PySide2.
Similarly, the warning discussed in issue 395 occurs if the parent's Qt bindings have higher precedence than the child's.
I have a use case where a python application launches other applications as subprocesses, and these subprocesses may have their own embedded python interpreter with their own versions of PyQt/PySide. In this case setting the QT_API environment variable automatically is undesirable, since the correct bindings should be resolved separately for each process. Only workaround I've found is unsetting QT_API after importing qtpy or whenever launching subprocesses.