Ankur Lathwal
Ankur Lathwal

Reputation: 725

Trying to convert .ui file to .py file using QT, getting error ImportError: DLL load failed: %1 is not a valid Win32 application

I am using PyQt5 and Pyhton3. I am using QT designer to make a .ui file and I need to convert it to .py file but when is use the command

pyuic5 filename.ui -o filename.py

on the command line, I get an error message:

    Traceback (most recent call last):
  File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python34\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python34\lib\site-packages\PyQt5\uic\pyuic.py", line 26, in <module>
    from PyQt5 import QtCore
ImportError: DLL load failed: %1 is not a valid Win32 application.

Can anyone suggest what can I do?

Upvotes: 2

Views: 2438

Answers (1)

harthart
harthart

Reputation: 414

open command prompt and type: cd location_of_your_pyuic5

i.e. cd C:\Users\Lenovo\Anaconda3\Library\bin

img 1

make sure that your .ui file is in the same location of your pyuic5. your converted file will also be placed in that location.

next is to type in your .ui file and the filename that you want for your converted .py file; then hit enter.

i.e pyuic5 -x filename.ui -o filename.py

img 2

hit enter and you shall see your .py file in that location

Upvotes: 1

Related Questions