Python crashes when trying open a second case file
I am using Python 2.7 to make API calls fir PSSE 30. My code works for a single run but crashes if I try to do multiple. There are definitely some variables I need to reset before I can do another run but I'm not sure what they are.
I defined the following commands in function and return their error codes. The main body loops the function through multiple cases. First run works fine, if the dynamic case can't run it tells me through the codes. Even if it can though the second run crashed and Windows pops up with a message that python has stopped working.
psspy.psseinit(150000)
psspy.case(caseFile)
psspy.runrspnsfile(convertIdv)
psspy.dyre_new([1,1,1,1],dynDate,"1","1","1")
psspy.strt(1,"")
psspy.run(1,1,60,1,5)
psspy.pssehalt_2()
How do I reset the PSSE API/clear only the variables from the function I've defined without wiping the error list I'm returning?
EDIT: By removing pssy.pssehalt_2() I can get it to run four cases before it crashes. I do not understand why though.
@Raithyn Also I just noticed, are you really using Python 2.7 with PSSEv30? I thought PSSEv30 used an earlier version of Python like Python 2.3 or Python 2.4