Hey Kurian, I'm not clear on this from your code example, but are you using the multiprocessing module from within Maya? Your example indicates that it is a standalone script. First, I don't think it is safe to use the multiprocessing module within Maya, since forking is not a very safe thing to do in that environment. And second, if you are going to handle the seg fault yourself, you would be expected to exit the process afterwards (since you aren't really doing anything to fix the problem), otherwise you are just going to make it continue having problems.
I think you should go the route that Marcus suggested, where you use subprocess. This will fork and exec a new process, instead of just forking your current image, which could lead to tons of problems in Maya. On Sat, Sep 6, 2014 at 10:11 AM, Kurian O.S <[email protected]> wrote: > I was wrong its not working :( > > def sig_handler(signum, frame): > pass > > def dosome(args, options): > #here is my seg fault coming > signal.signal(signal.SIGSEGV, sig_handler) > #maya functions goes here > > if __name__ == "__main__": > from multiprocessing import Process, Queue > p = Process(target=dosome, args=(args, options)) > p.start() > p.join() > > This is my code > > > On Fri, Sep 5, 2014 at 11:45 AM, Kurian O.S <[email protected]> wrote: > >> I got a hint that I was using signal.signal(signal.SIGSEGV, sig_handler) >> in wrong place. >> >> >> On Fri, Sep 5, 2014 at 11:20 AM, Marcus Ottosson <[email protected]> >> wrote: >> >>> Hi Kurian, >>> >>> Do you mean you are running separate processes that open up Maya in the >>> background to do some processing? >>> >>> Have a look at subprocess.Popen >>> <https://docs.python.org/2/library/subprocess.html#subprocess.Popen>, >>> it runs a process completely separate from where you ran it from and >>> shouldn't be affected by any of them crashing. They can also be run >>> concurrenctly, by just running many of them at the same time. You'll be >>> given a handle to the process where you can either communicate or just wait >>> (join), similar to Process(). >>> >>> Best, >>> Marcus >>> >>> >>> On 5 September 2014 19:52, Kurian O.S <[email protected]> wrote: >>> >>>> Hey Guys, >>>> >>>> I have a python script and it will loop through bunch of maya files and >>>> do some stuff. But some time maya get seg fault and my script will stop >>>> there. I tried with signal and multiprocess. But both failed >>>> >>>> def sig_handler(signum, frame): >>>> pass >>>> >>>> signal.signal(signal.SIGSEGV, sig_handler) >>>> >>>> >>>> from multiprocessing import Process, Queue >>>> p = Process(target=startCrawling, args=(args, options)) >>>> p.start() >>>> p.join() >>>> >>>> Both failed. >>>> >>>> Any other method which can trap seg fault and continue with next ? >>>> >>>> Thanks >>>> -- >>>> --:: Kurian ::-- >>>> >>>> -- >>>> 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/CANEMyhN3UQnJmc_mWYvQb%3D2B6d6LcNrCmqZ-AaY63DzmG8aSKQ%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/python_inside_maya/CANEMyhN3UQnJmc_mWYvQb%3D2B6d6LcNrCmqZ-AaY63DzmG8aSKQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> *Marcus Ottosson* >>> [email protected] >>> >>> -- >>> 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/CAFRtmODZ1cvY2OFNCF0q6Yg1GMrNd6_y1bcepXF9mZhWkuddgg%40mail.gmail.com >>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODZ1cvY2OFNCF0q6Yg1GMrNd6_y1bcepXF9mZhWkuddgg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> --:: Kurian ::-- >> > > > > -- > --:: Kurian ::-- > > -- > 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/CANEMyhOVgQrUtinX0jWRvdMixb3urCGEtBPtxHW%3DEYe8bed2aw%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CANEMyhOVgQrUtinX0jWRvdMixb3urCGEtBPtxHW%3DEYe8bed2aw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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/CAPGFgA0GzFTPT-ED3qKb6j3sutxG4CLp6OPxeN5zcjzeNPk0MQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
