Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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(30000)
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?

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(30000)
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.