LumaPictures / pymel

Python in Maya Done Right
Other
479 stars 130 forks source link

Pymel import PyQt4 and not PyQt5 #392

Open dalgos-adsk opened 7 years ago

dalgos-adsk commented 7 years ago

Pymel should be trying to import PYQt5 and fallback to PyQt4 if it fails. The behaviour expected should be similar to PySide2 and PySide.

This issue was discovered because a client tracks all Python scripts that attempt to import PyQt4.

 # Assign functions to PyQt versions if PyQt is available, otherwise set to PySide versions
    try:
        import sip
        import PyQt4
        pyQtAvailable = True
    except ImportError:
        pyQtAvailable = False

    try:
        import shiboken
        import PySide
        pySideAvailable = True
    except ImportError:
        pySideAvailable = False
        try:
            import shiboken2
            import PySide2
            pySideAvailable = True
        except ImportError:
            pySideAvailable = False

As can be seen, this script tries to import PyQt4, but it does not then try to import PyQt5 if that fails. (However, it does try to import PySide2 if it fails to import PySide.) In addition, elsewhere in the script it only import PyQt4.