Search code examples
pythonpyqtpyqt4maya

Animation script - No module named PyQt4


Hi I tried to use a animation script

free meshcache for maya

# this is the error that I have ( No module named PyQt4 # )

Error: line 1: ImportError: file C:/Users/Lav/Documents/maya/2016/scripts/meshCache_script.py line 5: No module named PyQt4 `

#I am using maya 2016 with service pack in window 7 64 bit

Is it possible to change this script, so that everybody can use without dealing with pyqt4 install or others.

If I could use this script, I really appreciate for you.

Thank you guys.


Solution

  • In the specific case of that script it should be as easy as replacing:

    from PyQt4 import QtGui, QtCore
    import sip
    

    with:

    from PySide import QtGui, QtCore
    import shiboken
    

    and then, on line 32, replacing:

    return sip.wrapinstance(long(controlPoniter), QtCore.QObject)
    

    with:

    return shiboken.wrapInstance(long(controlPoniter), QtGui.QWidget)
    

    Then follow the instructions here (where I assume you got the script) and it should work.

    What I suggested is what I believe the author was doing with the meshCache_script_2016.py file he mentions, in the page linked above. I downloaded the zipped file from there but couldn't find meshCache_script_2016.py in there, so you might want to ask the author if he omitted it on purpose (in case he realised that other parts of his script and/or plugin would break in Maya 2016, anyway).