hi,
I am trying to subprocess open mayapy and then open a maya.standalone session, initialize it and then proceed sending commands to the session like opening a maya file and doing stuff. all that from within a cmd prompt in windows.
I used as a base a slightly re-written version of Sebastian Wiesner, and coppled it with some custom ui loader of loading a qt designer file interface where the user can choose path and other stuff.
now inside the class MainWindow I try this:
def initializeMayaFile(self, path):
self.le_textOut.setText('...initializing Maya scene, please wait')
pmng = MayaPyManager( r'C:/Program Files/Autodesk/Maya2015/bin/mayapy.exe',
None
)
self.le_textOut.append (str(pmng))
pmng.run_module( "maya.standalone")
self.le_textOut.append ( str(pmng.run_command( "maya.standalone.initialize()" )))
I am not sure if he doesn’t even get to run_module, since it doesn’t return anything. but maybe that’s silenced by mayapy.
that’s my output and errors:
…initializing Maya scene, please wait
<main.MayaPyManager object at 0x00000000032EE8D0>
(’’, 'Traceback (most recent call last):
File “<string>”, line 1, in <module>
NameError: name ‘maya’ is not defined
')
anybody any idea if this would even work?
and even if it would work, later with the cmds.file (open) blabla I saw people hacked it by puting a certain time to wait. but since that depends on how heavy the files are. there’s no communication of wait until loaded and stuff?
I remember back in the days it was very easy to do a maya.standalone initialization. but I didn’t have to use mayapy. this time I have to because I need the registered modules there.
maybe someone tried already.
thanks.