Hi there,

I'm facing a problem that I never noticed before in python / qt : when I 
try to raise an error from a function triggered by a signal, I can't get 
the red message in maya. The error is raised in the script editor, but if 
the SE is closed, no way to know that an error occured.
To see what I mean, you can run the piece of code at the end of my post.
>From what I understood, it comes from the mechanism of signals / slots 
itself, like if the function triggered by a signal was 'local' only. If I 
call the same method manually (i.e. NOT with the signal), it works.
I tried with both pyqt4 and pyside, same result.
I have a couple of workarounds (I can use the api to raise my error 
instead, or I can use logging), but the truth is that I really like the 
built-in errors in python, and I'd love to be able to stick to this 
workflow if possible.
If anyone has a solution for that, I'd be really happy to know it ! 
Many thanks 

from PySide.QtGui import *
from PySide.QtCore import *
class Xxx(QWidget):
    def __init__(self, parent=None):
        super(Xxx, self).__init__(parent)
        self.ui()
    def ui(self):
        btn = QPushButton('Raise error')
        btn.clicked.connect(self.raiseError)
        mainLayout = QHBoxLayout()
        mainLayout.addWidget(btn)
        self.setLayout(mainLayout)
    def raiseError(self):
        raise NameError
a = Xxx()
a.show()

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/76b853ec-2ba8-4d79-85e4-fcf78be74cf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to