Hey Ben, If Maya is crashing due to something in the scene, the things I’ve suggested is void. The issue I was tackling was whether Maya crashed *inbetween* runs, which can sometimes cause a segmentation fault.
If you are still getting a crash, even when launching via subprocess, then it can’t have anything to do with the clean-up that normally occurs when closing one file and opening another, because each subprocess will be its own unique process that couldn’t possibly affect the following or prior processes. As far as the code you posted goes, I’m not sure what’s going on. 1. What is d? 2. What is in the MAYA_EXE variable? 3. What is in the BATCH_CONVERT variable? 4. Why are you keeping code from us? :) Oh and stdout and stderr of Popen are only necessary if you intend to print their output, as in my previous example, and if you are calling .communicate() you can replace Popen with call which basically does Popen followed by .communicate(). Less code == happier Marcus. On 25 November 2015 at 14:12, Ben Hearn <[email protected]> wrote: > UPDATE: > > I dug around inside the troublesome files and saw that a couple of them > were applying metadata with defunct file paths so I looked inside the > hierarchy and found some file nodes swimming around in there. I deleted the > nodes and hey presto. The process goes off without a hitch. > > Some of the file nodes were pointing to PSDs that do not exist, jpegs or > TGAs. Why would this cause Maya to crash though? Can file nodes become > corrupt or would Maya choke on defunct pathing under heavy iteration? Some > of the nodes were perhaps under File and were referencing PSDs which could > be an issue or vice versa. > > Thoughts? > > [image: Inline images 1] > > On 25 November 2015 at 14:44, Ben Hearn <[email protected]> wrote: > >> Hey guys, >> >> I have tried the solution to launch multiple Maya's. At first I split my >> iteration dictionary into 2 and ran the 2 Mayas in parralell which produced >> the same fatal error. So I split it into 4 and made ach Maya wait for the >> other to finish but I am still getting the same error on the same file in >> any case regardless of how many Maya processes I open up. >> >> As I stated earlier the file can be loaded normally or by script on it's >> own. Is there any way I can test files for fatal errors or any suggestions >> in debugging these particularly troublesome files? >> >> d = UTILS.linch_dict_divider(mayaFiles, 4) >> >> mayaExe = os.environ['MAYA_EXE'] >> mayaRunScript = os.environ['BATCH_CONVERT'] >> >> mayaSplitDict1 = d[0] >> mayaSplitDict2 = d[1] >> mayaSplitDict3 = d[2] >> mayaSplitDict4 = d[3] >> >> >> p1 = subprocess.Popen([mayaExe, '-script', >> mayaRunScript,str(mayaSplitDict1)], >> stdout=subprocess.PIPE, >> stderr=subprocess.STDOUT) >> p1.communicate() >> >> p2 = subprocess.Popen([mayaExe, '-script', mayaRunScript, >> str(mayaSplitDict2)], >> stdout=subprocess.PIPE, >> stderr=subprocess.STDOUT) >> p2.communicate() >> >> p3 = subprocess.Popen([mayaExe, '-script', >> mayaRunScript,str(mayaSplitDict3)], >> stdout=subprocess.PIPE, >> stderr=subprocess.STDOUT) >> #subprocess.Popen.communicate(subprocess.Popen) >> p3.communicate() >> >> p4 = subprocess.Popen([mayaExe, '-script', mayaRunScript, >> str(mayaSplitDict4)], >> stdout=subprocess.PIPE, >> stderr=subprocess.STDOUT) >> p4.communicate() >> >> On 24 November 2015 at 23:12, Geordie Martinez <[email protected] >> > wrote: >> >>> Marcus is right. subprocess is the best way. me likey. >>> However. you’re using pymel so before you begin be sure and set an >>> environment variable to turn *off *initializing plugins. Chad Vernon >>> sussed out this crash a week or two ago on this group. >>> >>> so set this variable if you’re on widows in your environment vars: >>> set PYMEL_SKIP_MEL_INIT = 1; >>> >>> or on linux: >>> >>> setenv PYMEL_SKIP_MEL_INIT 1 >>> >>> test it before hand to make sure it’ll work in subprocess. you don't >>> want to hunt down two different issues. >>> in a shell type: >>> mayapy >>> >>> you should get a python prompt then test this to make sure you don't get >>> a traceback. then you're ready to convert your code below to a subprocess >>> call. >>> >>> import maya.standalone >>> maya.standalone.initialize()import osimport pymel.core as pm >>> # you should see this next line if you set the environment variable >>> correctly.#pymel.internal.startup : INFO : Skipping MEL initialization >>> cube = pm.polyCube() >>> ## your code goes here >>> >>> pm.saveAs("someFile.ma")# result: Path('someFile.ma') >>> os._exit(0) >>> >>> >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/python_inside_maya/rOnS_4vY5sE/unsubscribe >>> . >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/python_inside_maya/CABPXW4jTXuTzP3VMbqLq3yXB9RgP%2B_9W2B10%2B3Xk9wt2Uw5%3DPA%40mail.gmail.com >>> <https://groups.google.com/d/msgid/python_inside_maya/CABPXW4jTXuTzP3VMbqLq3yXB9RgP%2B_9W2B10%2B3Xk9wt2Uw5%3DPA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> >> Tel - +46 76245 92 90 (Sweden) >> LinkedIn: http://www.linkedin.com/pub/ben-hearn/50/a64/33b >> > > > > -- > > Tel - +46 76245 92 90 (Sweden) > LinkedIn: http://www.linkedin.com/pub/ben-hearn/50/a64/33b > > -- > 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/CAM2ybkUTZq-gpvpcO1zKJGxSm0aZAUbmU10sRYOxmt%2Bk7WTv_Q%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAM2ybkUTZq-gpvpcO1zKJGxSm0aZAUbmU10sRYOxmt%2Bk7WTv_Q%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/CAFRtmOB3a5R1P8A805o9QXR42iJQ8aPuWir%2B%2B_EdQPqULEZs4Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
