Qt via mayapy vs Qt via python


#1

I’m getting my feet wet with some Qt work and I’ve ran into a bit of a roadblock. I can get the Qt process running fine when going through mayapy, but when I try and work through a vanilla version of Python27 (same version as mayapy at 2.7.11), I get the below Qt error -

“ImportError: No Qt binding were found.”

I was hoping someone here wouldn’t mind explaining to me what secret sauce is missing in Python27 vs mayapy and what exactly I need to do to port that secret sauce over to work with Python27.

In the Python27 environment I have both the Qt.py as well as the PySide2 package. Something is still obviously missing.

Any help or general explanation would be really swell. Cheers.


#2

I do believe the reason the binding wasn’t working was due to how I had my PYTHONPATH env set.

I turned QT_VERBOSE to “True” and saw that it wasn’t picking up PySide2. Added to the PYTHONPATH var and now it’s picking up, but getting this error now-

This application failed to start because it could not find or load the Qt platform plugin "windows"
in "".

Reinstalling the application may fix this problem.

#3

You can’t reuse the PySide2 binaries that ship with maya in a standalone python application.

You’d need a version of PySide2 that is compiled for vanilla python2.7, which isn’t currently supported by the official release, instead they require python3.5+.
Though there is a possibility that some of the slightly older version would work.


#4

I got it working! Turns out I was missing “platforms” folder in my Py2 interpreter HOME directory. Has four .dll files in it-

qconsole.dll
qminimal.dll
qoffscreen.dll
qwindows.dll

After adding the folder it works. I have zero clue why or how, but it’s working. :slight_smile: thank you for the reply.


#5

Interesting, so you’re using the PySide2 binaries from maya in a standalone python? or did you install PySide2 separately?


#6

I do have a PySide2 package that I’m referencing, but I’m not 100% sure off-hand if it came directly out of Maya or not. I assume it was a separate install. Right now I’m adapting the Plex open-source pipeline to our needs.

https://github.com/alexanderrichtertd/plex

There is a PySide2 package that comes with the download. I’ve learned a bunch from dissecting and modifying Alexander’s work. I could of just referenced mayapy as my interpreter, but I wanted the environment to be on the network for one and be divorced of requiring a local Maya install to run.

The primary program wasn’t launching unless it was launched via mayapy. Putting the platforms folder in the Py2 HOME dir from Maya fixed the issue.

Cheers and thank you for taking the time to reply! I’ll be back with more questions no doubt.