You might try Qt's threads? On Thu, Jun 10, 2010 at 9:43 AM, Paul Molodowitch <[email protected]>wrote:
> Well, I tried executing something that should have no output: > > import multiprocessing > > foo = [] > p = multiprocessing.Process(target=foo.append, args=(3,)) > p.start() > p.join() > > ...alas, this still caused a maya crash. Also, I tried using > executeInMainThreadWithResult: > > import multiprocessing > import maya.utils > > foo = [] > p = > multiprocessing.Process(target=maya.utils.executeInMainThreadWithResult, > args=(foo.append, 3)) > p.start() > p.join() > > ...and this made not difference either. (Actually, as I understand > it, since it's running as a separate process, shouldn't it ALREADY be > the main thread in that process?) > > I also tried gui maya 2009 (with the backported module - I tested it > with mayapy first to make sure it worked), and also got crashes with > multiprocessing. > > Unless I'm missing something obvious, it seems gui maya + > multiprocessing just don't get along... > > - Paul > > On Wed, Jun 9, 2010 at 9:18 PM, John Creson <[email protected]> wrote: > > In this case, are you printing into a maya gui? > > Perhaps, you need to try pushing the print to the main thread, so you > > don't step on Maya's event loop. > > > > import maya.utils > > import maya.cmds > > def doSphere( radius ): > > maya.cmds.sphere( radius=radius ) > > maya.utils.executeInMainThreadWithResult( doSphere, 5.0 ) > > > > On Wed, Jun 9, 2010 at 9:48 PM, Paul Molodowitch <[email protected]> > wrote: > >> So, given the issues with the GIL lock in python, I was excited about > >> using the new multiprocessing module... especially since a back port > >> is also available for python 2.5. > >> > >> I worked beautifully when I was playing around with it from mayapy - > >> but as soon as I tried to use it in a GUI maya, maya crashed > >> immediately. > >> > >> For the curious, here's what I was testing with: > >> > >> import multiprocessing > >> from pprint import pprint > >> > >> p = multiprocessing.Process(target=pprint, args=(dir,)) > >> p.start() > >> p.join() > >> > >> Does anyone know if I'm doing anything wrong here? As I said, it seems > >> to work fine when done from a console. Or does maya just not like > >> multiprocessing? I know that it can have some issues with threads... > >> but given that things such as subprocess seem to work fine, I had hope > >> for multiprocessing... > >> > >> - Paul > >> > >> -- > >> http://groups.google.com/group/python_inside_maya > > > > -- > > http://groups.google.com/group/python_inside_maya > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
