Hello Lidia, The issue is userSetup is run before the Maya UI has been created. You could try executing your command inside userSetup.py using cmds.evalDeferred which I believe will work.
Best, On Thu, Feb 26, 2015 at 6:50 AM, Lidia Martinez <[email protected]> wrote: > > I delete a shelf tab and add the same tab, updating the contents. > > The problem is that executing the code works inside Maya, but executing > the code under userSetup.py, the global MEL variable: > > $gShelfTopLevel > > That holds the path to the shelf,. But when executing the script, it is > EMPTY. So the script deleteShelfTab and everything else i do, doesn't > work... > > Why doesn't it work? > > > > Failed to execute userSetup.py > Traceback (most recent call last): > File "C:/Users/lmartinez/Documents/maya/scripts\userSetup.py", line 15, > in <module> > utils.executeDeferred(mayaInitScript.mayaInitScript()) > File "R:\resource\technical\maya\mayaInitScript.py", line 29, in > mayaInitScript > mel.eval("deleteShelfTab \"" + shelfName + "\"") > RuntimeError: Error occurred during execution of MEL script > file: C:/winapp/3d/Maya2015/scripts/others/deleteShelfTab.mel line 57: > setParent: Object '' not found. > > > > This works on an opened Maya. But this variable seems to be holding and > empty string... > I do nothing with it before this. > > > -- > Lidia > > -- > 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/CAAB1%3D8ws0ukzDeBvEW7HfZ%3DT%3DG_7UGK%3DSNN-%3D6L9KB-Scd1KeQ%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAAB1%3D8ws0ukzDeBvEW7HfZ%3DT%3DG_7UGK%3DSNN-%3D6L9KB-Scd1KeQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Tony -- 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/CAJhmvsRHbF3VWSFLny0DgN1pijP-euMZgBDLxnQ2rE_FAeWyuw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
