Does anyone knows how maya looks for dlls for a PyQt or PySide

Correct me if I am wrong in Linux we can specify paths of (.so) libraries LD_LIBRARY_PATH , but how does maya knows where to look for dll for PyQt4 or PySide otherwise we will get DLL load failed specified procedure not found …

PyQt has its own built in mechanism for adding dll search paths which might work for you:

QtGui.QApplication.addLibraryPath(qpath)

It takes a qstring as its argument. I use this currently within our toolset and it works (although only tested on windows). As for PySide I have no idea, but I’d imagine there is an equivalent if it isn’t the same.

Have you tried adding your directory to the system path?

AFAIK Qt does not seem to use the standard dll search paths when trying to load plugins (i.e. exe dir, cwd, system dir, PATH env var etc.).

As far as I understand it Qt only searches for plugin dlls in the paths returned by QtGui.QApplication.libraryPaths() (which you add to with the addLibraryPath() method).

I’d be interested to know if anyone manages to get it working by appending to PATH.

[QUOTE=btribble;19679]Have you tried adding your directory to the system path?[/QUOTE]

yes , but i still get this error
import PySide.QtGui

Error: line 1: DLL load failed: The specified procedure could not be found.

Traceback (most recent call last):

File “<maya console>”, line 1, in <module>

ImportError: DLL load failed: The specified procedure could not be found.

I’ve been struggling with the same issue but in MotionBuilder.

I don’t know what your exact situation is but here is mine:

I want to have one set of PyQt binaries built that work for both Maya and MotionBuilder.

I had a compiled version that worked in both, but ran into a crash in maya and had to get up-to-date binaries.

With the updated binaries I get the same error when trying to import QtGui in MotionBuilder:

# ImportError: DLL load failed: The specified procedure could not be found.

Then I discovered that if I remove or replace the Qt*.dlls in the MotionBuilder install path, I was able to load and run the PyQt modules!

Removing the dll’s only worked because I had added the directory to the new dlls to os.path in my userStartup.py. Otherwise, removing those dlls would cause MotionBuilder to fail to load.

Now, messing with the MotionBuilder install is not something I want to do - but it works for now.

Setting QApplication library path doesn’t seem to help - I think because you need to import the PyQt4 module in order to do that and at that point it has already loaded the DLLs.

I looked into using the ctypes module to either inspect and see what dlls are loaded or force MotionBuilder Python to load the dll that I specify without success.

I’ve also tried making sure that my path is the first path in os.paths.

If anyone has any other suggestions that would allow me to prevent the dlls in the MotionBuilder install path and use my dlls instead, I would love to hear!

Thanks!

-Andrew