QListWidget crashing Maya.

126 views
Skip to first unread message

Panupat Chongstitwattana

unread,
Feb 13, 2015, 9:37:08 AM2/13/15
to python_in...@googlegroups.com
Hi everyone.

I got a call from my previous studio that a PyQt script I wrote, which
worked with 2012-2014, is crashing their Maya 2015. So I came in to
take a look and I can't figure out the reason. I have quite a number
of script made and only this one is crashing.

The part that crash is basically just an if statement checking if the
user has a valid selection in QListWidget

if len(self.ui.fileList.selectedIndexes()) < 1:
print "A"
return

print "B"
# script continues

A would print fine. But then it crash and never made it to B. Any idea
what could be the cause of this? I'm not sure I'll have the time to
properly convert it to PySide for them which probably would be the
best way.

Best regard.

Marcus Ottosson

unread,
Feb 13, 2015, 10:08:58 AM2/13/15
to python_in...@googlegroups.com
If you're on Windows, double check that their PyQt version was compiled for the right version of Maya and Visual Studio. Some things might work with the wrong version, but you may get unexpected crashes doing ordinary things if not; maybe this is what you're seeing?


Justin Israel

unread,
Feb 13, 2015, 1:15:52 PM2/13/15
to python_in...@googlegroups.com

Are you saying, based on your example, that it prints "A" and then crashes right before the return statement? That seems strange. Can you reproduce the crash against a standalone PyQt? This may seem weird but try collecting the selected indexes into a variable first, and then operating on that list. I have seen odd bugs related to PyQt memory management sometimes when using the temporary output of a call, in a nested statement.

sel = self.ui.fileList.selectedIndexes()
if len(sel) < 1:
...

Does that crash? Also what type of widget is "fileList"? A QListWidget? Sometimes calling protected methods on widgets can trigger the crash. You might need to see if you should be called a public method instead.


On Sat, 14 Feb 2015 4:08 AM Marcus Ottosson <konstr...@gmail.com> wrote:
If you're on Windows, double check that their PyQt version was compiled for the right version of Maya and Visual Studio. Some things might work with the wrong version, but you may get unexpected crashes doing ordinary things if not; maybe this is what you're seeing?


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC4U8wuj4whbgR1%2BSnQCu4jRHEQ307iUTMa-Mbbc%2BNZ4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

ben....@starbreeze.com

unread,
Feb 14, 2015, 10:41:02 AM2/14/15
to python_in...@googlegroups.com
PyQt is very shifty for Maya 2015, we recently had a tools overhaul at my studio too and we had to change all PyQt references to PySide. We ran into no issues though, all you have to do is change PyQt to PySide and boom you are away. Hope this helps it does seem like an odd error to get

Justin Israel

unread,
Feb 14, 2015, 2:42:47 PM2/14/15
to python_in...@googlegroups.com

While the differences between PyQt and PySide aren't too big,  it isn't always as easy as changing the imports. PySide uses the equivalent of PyQt w/ sip API v2. That means if your PyQt code was ever using QString or QVariant, that you will have to fix those spots. Also, the Signal and Property object  references are a bit different.


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b922c312-eecd-4884-b4cf-994996a35d18%40googlegroups.com.

Ben Hearn

unread,
Feb 15, 2015, 6:19:56 AM2/15/15
to python_in...@googlegroups.com
Ahh, that I was unaware of thanks for the knowledge update! :)

--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/1uQpnS-ynNQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1fx9MsWFv1xJftc02Lo4rjckskVbdq0Na%2Bziw0t42vUw%40mail.gmail.com.

Panupat Chongstitwattana

unread,
Feb 16, 2015, 3:11:30 AM2/16/15
to python_in...@googlegroups.com
Hi everyone. Sorry for the delay, replies are not sent to my inbox for some reason. After checking a few hours it turned out they compiled the wrong version of Qt. I recompiled it and everything works now. Thank you for your help :)

Been thinking seriously about recoding my scripts into PySide. It there any big differences I should be aware of before I start?

Best regard.

Justin Israel

unread,
Feb 16, 2015, 3:53:31 AM2/16/15
to python_in...@googlegroups.com

This should give you an idea:
http://qt-project.org/wiki/Differences_Between_PySide_and_PyQt

Its not really too much different. In some cases for smaller stuff you may end up changing only import statements. In others you may need to change more.


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5299ae0d-3ed6-47cf-b8cb-0b8f44a570f3%40googlegroups.com.

Panupat Chongstitwattana

unread,
Feb 17, 2015, 7:19:20 AM2/17/15
to python_in...@googlegroups.com
Thank you for your help Justin.

I have a bit of an unrelated question regarding Qt Flags. I'm curious how to find list of available flags I can set?

For example setWindowFlags. When I go to this page

http://qt-project.org/doc/qt-4.8/qwidget.html#windowFlags-prop

windowFlags would send me to windowTypes and windowTypes sends me right back to windowFlags, round and round. Am I looking at the right place?

Thank you.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

Marcus Ottosson

unread,
Feb 17, 2015, 7:26:54 AM2/17/15
to python_in...@googlegroups.com
This might be what you're looking for.

Panupat Chongstitwattana

unread,
Feb 17, 2015, 8:06:37 AM2/17/15
to python_in...@googlegroups.com
Thank you Marcus! I should keep this bookmarked :D
Reply all
Reply to author
Forward
0 new messages