I'm not sure if you are joking or not, so I will just reply assuming you are serious..
It isn't weird that Maya would close if you call sys.exit within a script. What behavior were you expecting? https://docs.python.org/2/library/sys.html#sys.exit Calling that from a main thread will kill your process. It might make sense to do that from a standalone main application. But Maya is a persistent process that can host many scripts within its python interpreter. You don't want to be using sys.exit there. Python has the common "if __name__ == 'main'" idiom just for this reason. To check if your script is the main process or not. You should only use exit if you are the main process, otherwise anyone importing and running your script in their app (Maya) will get adverse effects. On Sun, 20 Dec 2015 11:16 PM Rudi Hammad <[email protected]> wrote: > okey, I´ll try to explain. Usually, in my scripts I uses sys.exit() > So, if have a script that requires something to be selected, and nothing > is selected, what I do is cmds.warning ("please select something") and then > sys.exit() > this works perfectly fine if I execute " manually" the script, but in a > Pyside UI ( I followed this tutorial > http://www.brechtos.com/using-qt-designer-pyside-create-maya-2014-editor-windows/ > ) > when I connect that script to a button click, after the warning, maya > closes. I don´t think it is a crash, because I don´t get any window error. > isn´t that weird? > > -- > 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/6d340e44-527a-4158-af25-7d2585204ad5%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/6d340e44-527a-4158-af25-7d2585204ad5%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAPGFgA3WdF34wxnpahJ8RiL%2BwxVrcHDA%2BRs2-Vrd6JfhVT6iCg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
