Results 1 to 7 of 7

Thread: PyQt4 - Code generation faied: unable to launch...

  1. #1
    Join Date
    Jun 2008
    Location
    Bulgaria
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Question PyQt4 - Code generation faied: unable to launch...

    Hello,

    I am trying to use PyQt4 Designer, but I am having troubles running it. The Designer is runnig weell but when I go to Form -> View Code... an error ocurrs: Unable to lounch C:/Python25/PyQt4/bin\uic
    I tried reinstalling it, etc., no solution.
    I use PyQt4 installed from binary gpl
    I use Python 2.5.2
    When I type python in CMD the Python starts corretly
    When i type in Python shell import PyQt4, it is importing corretly.
    I use Windows Vista Ultimate SP1

    Can you help me to make my PyQt4 Designer work

    All the Best!

  2. #2
    Join Date
    Jun 2008
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: PyQt4 - Code generation faied: unable to launch...

    Maybe you should generate python code with pyuic4.bat file which installs in
    c:\pythonXX dir?
    pyuic4.bat youfile.ui >generated.py helps?

    I personally load those ui files on the fly without generating python code:
    something like this works for me:
    Qt Code:
    1. import sys
    2. from PyQt4 import QtCore,QtGui,uic
    3. form_class, base_class = uic.loadUiType("unnamed.ui")
    4.  
    5. class MyWidget (QtGui.QWidget, form_class):
    6. def __init__(self,parent=None,selected=[],flag=0,*args):
    7. QtGui.QWidget.__init__(self,parent,*args)
    8. self.setupUi(self)
    9. if __name__ == '__main__':
    10. app = QtGui.QApplication(sys.argv)
    11. form = MyWidget(None)
    12. form.show()
    13. app.exec_()
    To copy to clipboard, switch view to plain text mode 
    Try this little script with your ui file.

  3. #3
    Join Date
    Jun 2008
    Location
    Bulgaria
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: PyQt4 - Code generation faied: unable to launch...

    Thank you for the support.
    Yes I`ve already used the pyuic4.bat and pyrcc4.exe from the command line.. and it works fine.

    Are there any advantages using the .ui file instead of the generated .py, optimization or something else?

  4. #4
    Join Date
    Jun 2008
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: PyQt4 - Code generation faied: unable to launch...

    Main advantage: no need to generate code
    Just load ui file instead of loading generated code.
    Disadvantage i think is a speed of execution.
    May be it's a little slower than running pre-generated files...

  5. #5

    Default Re: PyQt4 - Code generation faied: unable to launch...

    Hi, I tried to use the script but I got the following error:

    Can´t get _Z10forcepointR11QTextStream from the dinamic link library of Qtcore.dll

    I need help!!!

    I'm using Python 2.5 and PyQt v4.4.2

    Edit: I have some problems importing QtCore!!!

    Edit2: I have solved the error that was launched when I tried to compile the .ui file, if you have the same problem with the Qtcore4.dll on windows, you must copy Qtcore4.dll (C:\Python25\Lib\site-packages\PyQt4 in my PC) and paste it in windows/system32. It looks so primitive but it worked. Now my problem is to run de .py code because the "Import QtGui" sentence throws a DLL error again, I'll get crazy about this T_______T

    Final Edit: Ok I solved it again, On windows we must copy and paste the DLL files into system32 folder to make them work with our .py file. Maybe some imports like QtCore and QtGui will throw a DLL error so If you have installed PyQt v4.4.2 on windows and you are using python 2.5 maybe you will have this path directory C:\Python25\PyQt4\bin.

    In this folder you can find all de DLLs needed for using PyQt and you just have to copy them as you need them.

    Once you have copied the DLL files you can compile de .ui file using the next command on console (cdm), and you must be loceted in the folder where you have the .ui file

    pyuic4 -o fileName.py -x yourFileName.ui

    and this will make your .py file from the .ui file

    I hope my English writting becomes fine to understood
    Last edited by Lighther; 17th July 2008 at 01:29.

  6. #6
    Join Date
    Mar 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: PyQt4 - Code generation faied: unable to launch...

    I have other problem ...
    When creating resource file with pyrcc4 (on win7, PyQt4 ) ...
    Qt Code:
    1. C:\Users\WM\workspace\ImageChanger\src>pyrcc4 -o qrc_resources.py resources.qrc
    To copy to clipboard, switch view to plain text mode 
    Console returns:
    Qt Code:
    1. pyrcc4 Parse Error:resources.qrc:1:1 [unexpected end of file]
    To copy to clipboard, switch view to plain text mode 

    Help me Please!

  7. #7
    Join Date
    Apr 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: PyQt4 - Code generation faied: unable to launch...

    Hi all!
    Comming back to the topic od converting some ui to python code I am trying to do that..but have problems with using pyuic4. I lost my confidence in what l should use at all, is pyuic4 a good command to use? or should I use pyuic.bat file... or is there some other way to go?
    Would be grateful if somebody could give me a hint how the command looks like on Windows?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.