Download

PySide module import error: DLL load failed: %1 is not a valid Win32 application

I’m trying to make some simple UI tools in Unreal using PySide and Qt Designer. However I can’t seem to be able to import any PySide modules. For instance, if I run this code:


import sys
sys.path.append('C:/Python27/Lib/site-packages')
from PySide import QtGui

…I always get this error:


LogPython: Error: ImportError: DLL load failed: %1 is not a valid Win32 application.

I discovered I had a 32 bit version of Python 2.7 installed, so I initially thought the culprit could be a bit version mismatch issue between Python and PySide (32 bit Python with 64 bit PySide). I couldn’t figure out how to check the bit version of PySide, so to be safe I reinstalled both Python and PySide using their 64 bit installers. But after doing that I still get the same error.

Any ideas about what I’m doing wrong?

I just pip installed PySide under the unreal engine installed python.


C:\Program Files\Epic Games\UE_4.21\Engine\Source\ThirdParty\Python\Win64>python -m pip install --upgrade pip
C:\Program Files\Epic Games\UE_4.21\Engine\Source\ThirdParty\Python\Win64>python -m pip install PySide

Thanks, that did the trick. I had not realised that UE was using its own Python installation instead of the one from the OS, which makes complete sense now that I think about it.

I just tested import sys and append sys.path,is worked
It is found that the results are feasible
I think UE python read PC dir ,not UE dir