I've never used the uninitialize call. Does it crash when you don't use that? Does it provide important functionality in a shell script?
I too have seen crashes during exit, and the quick fix can be to use os._exit(0) This will force the python interpreter to exit quickly without calling any of the atexit shutdown handlers, which Maya can be using for plugin unloading and other shutdown operations. If you have done everything you need to do, closed and flushed all files and output, etc, then you may be fine with this approach. Justin On Fri, Jan 27, 2017, 4:00 AM Robert White <[email protected]> wrote: > I've had the interpreter crash a lot on exit due to plugins not unloading > cleanly. Might be worth trying it with all of them disabled? > > On Thursday, January 26, 2017 at 5:22:45 AM UTC-6, Erik Karlsson wrote: > > Hi everyone! > > I'm trying to get maya 2017 up and working. But I'm having some issues. > This time it's the mayapy.exe. It's not behaving the way it did in 2016. I > can't run it cleanly without a crash... > > I get a windows popup saying PythonInterpreter has stopped working. > > And this is the output from the commandline: > > i:\python\scripts>"c:\Program Files\Autodesk\Maya2017\bin\mayapy.exe" > testMayaPy.py > [u'frontShape', u'perspShape', u'sideShape', u'topShape'] > Stack trace: > python27.dll!PyInterpreterState_Delete > python27.dll!PyGILState_Ensure > CommandEngine.dll!TpythonLock::initLock > ExtensionLayer.dll!TelfUtils::TelfUtils > ExtensionLayer.dll!TscriptAction::~TscriptAction > SharedUI.dll!TsetManipValueAction::callContext > SharedUI.dll!TelfIconTextButtonCmd::skipFlagForCreateCmd > SharedUI.dll!QmayaHotkeyEditor::qt_static_metacall > SharedUI.dll!QmayaHotkeyEditor::qt_static_metacall > ntdll.dll!RtlDeactivateActivationContextUnsafeFast > ntdll.dll!LdrShutdownProcess > ntdll.dll!RtlExitUserProcess > KERNEL32.DLL!ExitProcess > MSVCR110.dll!_initterm_e > KERNEL32.DLL!BaseThreadInitThunk > ntdll.dll!RtlUserThreadStart > > > the python file "testMayaPy.py" I'm running is simple and looks like this: > > import maya.standalone > maya.standalone.initialize(name='python') > > import maya.cmds as cmds > > print cmds.ls(type='camera') > > maya.standalone.uninitialize() > > > It looks like the script runs fine but has troubles when exiting in 2017. > In Maya 2016 everything works fine. I get this output: > > i:\python\scripts>"c:\Program Files\Autodesk\Maya2016\bin\mayapy.exe" > testMayaPy.py > [u'frontShape', u'perspShape', u'sideShape', u'topShape'] > > > Anyone else having similar problems, and possibly a workaround? > > The idea is to batchprocess a bunch of maya files. But since I get a crash > for every file in the loop, I need to click the annoying "Interpreter has > stopped working" window for it to continue. So I managed to process 100 > maya files with 100 clicks, which is not ideal... > > thanks! > /Erik > > -- > 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/ee83fec9-9835-424e-831e-e31573b01f9e%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/ee83fec9-9835-424e-831e-e31573b01f9e%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/CAPGFgA0qa%2B3stBi2T5%3D1jrSVvNfPfYumvZjNRGg%3DBU%2Bf%3DvGXcw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
