Wrong exit code with mayapy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there!
With Maya 2018 Update 4 and Update 5, we have a serious issue when importing pymel in a script launched with mayapy. Whenever an exception gets raised during the execution of mayapy, the execution stops and the exception traceback gets printed, but the exit code is always 0! So, our render dispatcher does not recognize anymore when a script failed. You can easily reproduce this under Linux:
#!/usr/bin/env mayapy raise RuntimeError("test...") import pymel.core Here, the exception gets raised before importing pymel. My exit code is 1, as expected:
[carlo.gi@rd006 ~]$ ./foo Traceback (most recent call last): File "./foo", line 3, in <module> raise RuntimeError("test...") RuntimeError: test... [carlo.gi@rd006 ~]$ echo $? 1 But when I raise the RuntimeError after the pymel import, like this:
#!/usr/bin/env mayapy import pymel.core raise RuntimeError("test...") Then I get following:
[carlo.gi@rd006 ~]$ ./bar This plugin does not support createPlatformOpenGLContext! pymel.core : INFO : Updating pymel with pre-loaded plugins: renderSetup Warning: file: /opt/grid/software/thirdparty/autodesk/maya/maya-2018.update4/bin/../scripts/startup/initialStartup.mel line 179: Y-axis is already the Up-axis Traceback (most recent call last): File "./bar", line 5, in <module> raise RuntimeError("test...") RuntimeError: test... [carlo.gi@rd006 ~]$ echo $? 0 We see that Maya gets started and that the error gets raised, but my exit code is 0!
This does not happen with maya.standalone.initialize(). But we need pymel to startup Maya correctly, since the maya.standalone.initialize() does not load modules and plugins correctly (maybe if this could be fixed, we would be happy to not use pymel at all).
This issue also appears only in Update 4 and 5. 3 is running as expected.
Can you reproduce this issue and hopefully fix this in another Update 6? This is kind of urgent for us.
Thanks for any help!
Greets,
Carlo