How to terminate maya running inside python idle?

698 views
Skip to first unread message

aku.m...@gmail.com

unread,
Mar 12, 2009, 12:56:47 PM3/12/09
to python_inside_maya
In python idle I hav initalized maya with standalone module.
After workin on it.. i would like to terminate the initialized maya
modules ...
how do i destroy initialized maya, even if i del the
maya.standalone.... my pythonw... is running with huge memory
consumption. how to kill/destroy/del the maya standalone.
Its troughing memory exceptioin each time i close my python idle.

Ian Jones

unread,
Mar 13, 2009, 1:17:28 PM3/13/09
to python_in...@googlegroups.com
I asked a similar question on the autodesk subscription forums a while ago.

There response follows:

"Hi Ian,

From mayapy if you run help(‘maya.standalone’) you’ll see that it has
only one function initialize(), so to restart Maya you need to exit
the parent python process.

I have opened a Service Request # 1-4914842102 on your behalf and I’m
going to log a SUG on it.

Regards,
Avto"

So you essentially can't.

However I was able to work around the issue by using the
multiprocessing (http://docs.python.org/library/multiprocessing.html
py2.6) and pyprocessing (2.4/2.5) packages.
This way I ran maya in another process and was able to capture the
results. Not quite the same but I've been able to get it to work for
me.

Ian
ask

aku.mar.zen

unread,
Mar 14, 2009, 12:37:24 PM3/14/09
to python_inside_maya
bad... thts my first step in maya python... and its slipping. hmmm...
anyway.. thx Ian.

-kumar

On Mar 13, 10:17 pm, Ian Jones <i...@ambientdivide.com> wrote:
> I asked a similar question on the autodesk subscription forums a while ago.
>
> There response follows:
>
> "Hi Ian,
>
> From mayapy if you run help(‘maya.standalone’) you’ll see that it has
> only one function initialize(), so to restart Maya you need to exit
> the parent python process.
>
> I have opened a Service Request # 1-4914842102 on your behalf and I’m
> going to log a SUG on it.
>
> Regards,
> Avto"
>
> So you essentially can't.
>
> However I was able to work around the issue by using the
> multiprocessing (http://docs.python.org/library/multiprocessing.html
> py2.6) and pyprocessing (2.4/2.5) packages.
> This way I ran maya in another process and was able to capture the
> results. Not quite the same but I've been able to get it to work for
> me.
>
> Ian
>
> On Thu, Mar 12, 2009 at 9:56 AM, aku.mar....@gmail.com

Ofer Koren

unread,
Mar 14, 2009, 8:11:32 PM3/14/09
to python_in...@googlegroups.com
This might work:

import maya.cmds as mc

mc.quit(force=True)



Flags

abortexitCodeforce
Long name (short name)argument types Properties
force(f)booleancreate
If specified, this flag will force a quit without saving or prompting for saving changes. Use at your own risk.
exitCode(ec)uintcreate
Specifies the exit code to be returned once the application exits. The default exit code is 0.
abort(a)booleancreate
Will quit without saving like -force, but will also prevent preferences/hotkeys/colors from being saved. Use at your own risk.

aku.mar.zen

unread,
Mar 16, 2009, 12:02:13 PM3/16/09
to python_inside_maya
No much use...

IDLE 1.2.2
>>> import maya.standalone as ms
>>> ms.initialize()
>>> import maya.cmds as mm
>>> mm.quit(force=1)

No effect! Still maya modules are loaded!
This might quit the MAYA Safly.... But modules loaded once are still
in memory.. I can't unload that!






On Mar 15, 5:11 am, Ofer Koren <kor...@gmail.com> wrote:
> This might work:
> import maya.cmds as mc
>
> mc.quit(force=True)
>
> Flagsabort<file:///C:/program%20files/autodesk/maya2008/docs/Maya2008/en_US /CommandsPython/quit.html#flagabort>
> , exitCode<file:///C:/program%20files/autodesk/maya2008/docs/Maya2008/en_US/C ommandsPython/quit.html#flagexitCode>
> , force<file:///C:/program%20files/autodesk/maya2008/docs/Maya2008/en_US/Comm andsPython/quit.html#flagforce>Long
> name (short name)*argument types*Properties*force*(*f*)*boolean*[image:
> create]If specified, this flag will force a quit without saving or prompting
> for saving changes. Use at your own risk.*exitCode*(*ec*)*uint*[image:
> create]Specifies the exit code to be returned once the application exits.
> The default exit code is 0.*abort*(*a*)*boolean*[image: create]Will quit

Chris G

unread,
Mar 16, 2009, 6:58:50 PM3/16/09
to python_in...@googlegroups.com
There is no way to cleanly do this without terminating the process the libraries are loaded into.  You could try to do it very uncleanly using ctypes, such as:
...
mm.quit(force=1)
lib = ctypes.CDLL('mayalibrary.so')
h
= lib._handle
del lib
dlclose(h)

s.p.jangid

unread,
Mar 17, 2009, 4:38:06 AM3/17/09
to python_in...@googlegroups.com
please unsubscribe
Reply all
Reply to author
Forward
0 new messages