user1851132
user1851132

Reputation: 341

Error converting .ui file to .py file

I created notepad.ui the file in Qt4 Designer and tried to create the notepadwindow.py file by means of a command

pyuic4.bat notepad.ui -o notepadwindow.py

As a result I got the following error

Traceback (most recent call):
  File "C:\Python27\Lib\site-packages\PyQt4\uic\pyuic.py" line 31, in <module>
    from PyQt4 import QtCore
Import Error: DLL load failed: %1 then something strange on a different encoding Win32. 

Upvotes: 3

Views: 12435

Answers (9)

Sohrab
Sohrab

Reputation: 187

For me, it had something to do with the path, maybe it was too long. I copied the .ui file to another folder and ran the command and it worked.

Upvotes: 0

Anuj Yadav
Anuj Yadav

Reputation: 1

use same version of python and PyQt .It worked out for me in solving error ImportError: DLL load failed: The specified module could not be found.

Upvotes: 0

Ceppy Nurul Huda
Ceppy Nurul Huda

Reputation: 9

This is what i usually do when converting:

  • move to .ui file location with : cd /d D:\yourdirectory
  • YourPyuicLocation -x inputname.ui -o outputname.py

example :

C:\Users\ceppy\AppData\Local\Programs\Python\Python35\Lib\site-packages\PyQt5\pyuic5.bat -x Test.ui -o Test.py

Upvotes: 0

Anil Hatiboglu
Anil Hatiboglu

Reputation: 11

I experienced with the same error and was able to solve it.

Although I work on a 64-bit Windows, my python shell (2.7.11) and all extension packages are 32-bit and they work well. I faced with many errors because my PyQt4 that i downloaded was 64-bit. When i remove it and install 32-bit PyQt4 the problem is gone and now i am able to convert .ui files to .py

Maybe your problem is the same with me or visa versa, but the versions of both idle and PyQt should match, either 32 or 64-bit.

Upvotes: 1

Craig Yang
Craig Yang

Reputation: 340

I think there are at least two possible error conditions

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

then you have to check your PyQT version is comptible with your python. In other words, if you use python 3.3, then you can only use PyQT for python3.3 and python 3.3 will not work with PyQT for python3.4

This was the problem I met. I solved it with re-install it

2. Import Error: DLL load failed: %1 then something strange on a different encoding Win32.

then it would be a OS problem. If you use 32bit Python then you have to use 32bit PyQt, so do 64bit

Upvotes: 0

Maverick
Maverick

Reputation: 11

I had the same problem with PyQt5 64-bit edition. Removed and replaced with 32-bit edition, then entered at the command prompt: pyuic5 -x "input.ui" -o "output.py" Ran great.

Upvotes: 0

Aleksandar
Aleksandar

Reputation: 3661

This is how I do it:

pyuic4 -x name.ui -o name.py

of course, in cmd go to the directory where your notepad.ui file is. Good luck.

Upvotes: 2

Uahmed
Uahmed

Reputation: 1845

Some installation issue i guess

pyuic4 notepad.ui > notepad.py

this works for me

Upvotes: 1

Sujit Shakya
Sujit Shakya

Reputation: 53

open cmd and go to the directory where the ui file is being saved and there you write the following command.

pyuic4 -w notepad.ui > notepadwindow.py

Upvotes: 0

Related Questions