Scripting - struggling to get pyQt to work

399 views
Skip to first unread message

Simon Anderson

unread,
Mar 1, 2011, 7:15:30 AM3/1/11
to soft...@listproc.autodesk.com

Hi List,

I was wondering if anyone has encountered this problem when trying to
use pyQT, I think i may be have a path left out from my environment
variables or haven't clicked something to set everything up, but i keep
getting the error below

Traceback (most recent call last):
File
"C:\Users\simon.anderson\workspace\Testing\src\dombookmarks.pyw", line
45, in <module>
from PyQt4 import QtCore, QtGui, QtXml
ImportError: DLL load failed: The specified procedure could not be found.

I have Python 2.6 64bit version installed and installed the 64bit
executable of PyQt, and I cant seem to create a QT windows from the xsi
script interface, I can create a Qt window from the pywin interface.

Any help would be greatly appreciated

Thanks

Si


Stephen Blair

unread,
Mar 1, 2011, 7:19:02 AM3/1/11
to soft...@listproc.autodesk.com
Maybe it is the Qt DLLs shipped with Softimage.

>From an earlier post on the list

From: softimag...@listproc.autodesk.com [mailto:softimag...@listproc.autodesk.com] On Behalf Of Stephen Blair
Sent: January-06-11 1:59 PM
To: soft...@listproc.autodesk.com
Subject: RE: conflict with QT DLLs inside Softimage 2011.5

We don't use the Qt DLLs.
I believe the idea was to ship the Qt dlls for plugins that use Qt, so that the dlls were already in place.


From: softimag...@listproc.autodesk.com [mailto:softimag...@listproc.autodesk.com] On Behalf Of Xavier Lapointe
Sent: January-06-11 1:52 PM
To: soft...@listproc.autodesk.com
Subject: conflict with QT DLLs inside Softimage 2011.5

Hi guys,

I had a strange problem today using PyQt4 (latest x86_64 version) and softimage 2011.

Here's the traceback:

# INFO : Traceback (most recent call last):
# File "C:\dev\sourceAssets\src\__init__.py", line 5, in <module>
# from PyQt4 import QtGui
# ImportError: DLL load failed: The specified procedure could not be found.

Finally found that the problem comes from the Qt DLLs inside the softimage installation bin directory
(C:\Program Files\Autodesk\Softimage 2011 Subscription Advantage Pack\Application\bin)

I fixed it by renaming the Qt DLLs with a .bak extension ... but I was wondering if this could cause any problem to Softimage, and if anyone of you had this problem and managed to solve it (let say without renaming the DLLs)?

winmail.dat

Simon Anderson

unread,
Mar 1, 2011, 7:40:19 AM3/1/11
to soft...@listproc.autodesk.com
Thank you!!! works perfectly,

WOO!! I do the Stephen Blair dance of awesome! haha.. taken me the whole
day trying to figure out why this wasn't working.

Stefan Kubicek

unread,
Mar 1, 2011, 7:43:10 AM3/1/11
to soft...@listproc.autodesk.com
Hi Simon,

I tried this too and trying to create a Qt window from inside Softimage crashes Qt instantly.
The one thing I've read here on the list some months ago is that you need to remove the QT dll's
that ship with Softimage before attempting anything. Didn't help in my case though, I'm still stuck.

Copy/paste from previous thread:

even get instant


--
-------------------------------------------
Stefan Kubicek Co-founder
-------------------------------------------
keyvis digital imagery
1050 Vienna Wehrgasse 9 Austria
Phone: +43/699/12614231
--- www.keyvis.at ste...@keyvis.at ---
-- This email and its attachments are
--confidential and for the recipient only--

Stefan Kubicek

unread,
Mar 1, 2011, 7:44:10 AM3/1/11
to soft...@listproc.autodesk.com
Sorry, too fast on the send button:


What I managed to do so far is install pyQT for Python 2.6 x64 (which seems to be the Python version installed with Softimage 2011)
inside the site-packages folder of Softimage's own Python folder.
I can now import modules (yes, I renamed the default Qt dll's installed in Softimage's Application/bin folder to avoid any conflicts),

from PyQt4.QtGui import *
from PyQt4.QtCore import *

...but Softimage will fast-exit when I try to open a window (not to mention that it's not parented to the main window):


class MainWindow(QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.filename = None
self.dirty = False
self.listWidget = QListWidget()
self.setCentralWidget(self.listWidget)
self.setWindowTitle("ListKeeper - Unnamed List")

MainWindow()


This will bomb Softimage instantly.

Simon Anderson

unread,
Mar 1, 2011, 7:51:26 AM3/1/11
to soft...@listproc.autodesk.com
Thanks Stefan,

got it working finally, after just about ripping my hair out and turning
my OS path system into swiss cheese

Stefan Kubicek

unread,
Mar 1, 2011, 7:59:14 AM3/1/11
to soft...@listproc.autodesk.com
Nice, now if some kind soul would kindly point out how to create a simple Qt window without crashing Softimage I would be eternally grateful.
Any of my attempts so far lead to Softimage instantly crashing (including the sample code I just posted again).
Or to be more blatant: What the heck does your code look like, if you don't mind sharing :-)

Humbly yours,

Stefan

Simon Anderson

unread,
Mar 1, 2011, 9:00:58 AM3/1/11
to soft...@listproc.autodesk.com
Heres a quick tut i was doing, the code comes from
http://www.learningpython.com/2008/09/20/an-introduction-to-pyqt/ as im
still super noob at Qt.
Tested it in my XSI and it loads and works :)

hope that helps


import PyQt4
import sys
from PyQt4 import QtGui


class HelloWindow(QtGui.QMainWindow):

def __init__(self, win_parent = None):
# Init the base class
QtGui.QMainWindow.__init__(self, win_parent)
self.create_widgets()

def create_widgets(self):
# Widgets
self.label = QtGui.QLabel("Say Hello:")
self.hello_edit = QtGui.QLineEdit()
self.hello_button = QtGui.QPushButton("Push Me!")
# Horizontal layout
h_box = QtGui.QHBoxLayout()
h_box.addWidget(self.label)
h_box.addWidget(self.hello_edit)
h_box.addWidget(self.hello_button)
# Create central widget, add layout, and set
central_widget = QtGui.QWidget()
central_widget.setLayout(h_box)
self.setCentralWidget(central_widget)


#if __name__ == "__main__":
# Someone is launching this directly
# Create the QApplication
app = QtGui.QApplication(sys.argv)
# The Main window
main_window = HelloWindow()
main_window.show()
# Enter the main loop
app.exec_()

Michal Doniec

unread,
Mar 1, 2011, 10:23:01 AM3/1/11
to soft...@listproc.autodesk.com
If I can give one tip, do not attempt to re-create or create  new QtApplication instance every time you run your QT app. Re-use existing one. Code below will create new instance every time. Most probably if you try to run it twice (or more, it's small app) it will crash softimage.
 
Another tip, you can attach QT window to softimage window using win32com SetParent(), for some kind of modality.
 
Sorry for being a bit vague, but I am tied with NDAs.

--
----------
Michal
http://uk.linkedin.com/in/mdoniec

Stefan Kubicek

unread,
Mar 1, 2011, 11:10:33 AM3/1/11
to soft...@listproc.autodesk.com
Yessss, this works! Thanks a ton Simon, I'll name my first son after you :-)

@Dominic: Right, I was just looking into this. "win_parent" in QtGui.QMainWindow.__init__(self, win_parent)
caught my eye, but I guess it expects another Qt widget instead of an hwnd handle? I've used pywin32 for QMenu
in a similar way, lets see where it gets me in this case. Thanks for the heads up.


Stefan

Michal Doniec

unread,
Mar 1, 2011, 11:28:44 AM3/1/11
to soft...@listproc.autodesk.com
I think you are reffering to me as Dominic ;)
Anyway,
to attach qt win to softimage win. You have to get softimage win handle (dig into docs, there is a c++ api method for it) then get window id from your Qt window using  winId() method then win32com.setParent(qtWindowHandle, SoftimageWindowHandle))
Hope that makes sense.

Stefan Kubicek

unread,
Mar 1, 2011, 11:33:46 AM3/1/11
to soft...@listproc.autodesk.com
Gotcha, and sorry for misspelling your name :-)
Typing and at the same time watching 2012 new feature videos doesn't work so well...
Thanks again,

Stefan

Reply all
Reply to author
Forward
0 new messages