3

Invalid file type (OpnApplFil/OPNPTI) when saving

I tried to save a file recently with the following script:

import sys, os
PSSE = "c:/Program Files/pti/psse32/pssbin"
sys.path.append(PSSE)
os.environ['PATH'] += PSSE + ';'

import psspy
psspy.throwPsseExceptions = True

psspy.newcase_2(titl1="an empty saved case")
psspy.bus_data_2(101)
psspy.save("empty.sav")

and PSSE shows this error:

Invalid file type. empty.sav (OpnApplFil/OPNPTI)
Traceback (most recent call last):
  File "top_secret_consulting_work.py", line 72 in <module>
    psspy.save("empty.sav")
  File ".\psspy.py", line 13500, in save
psspy.SaveError: save Error: ierr=3

When looking up in the API ierr=3 is:

error opening SFILE.

Anyone have any ideas about what the problem is?

JervisW's avatar
1.3k
JervisW
asked 2012-04-07 03:56:01 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

2

You get this rather misleading error when running Python on top if your environment is not setup properly.

The code in the question places the delimiter ';' after the PSSE path instead of between the current path and PSSE path.

os.environ['PATH'] += PSSE + ';'

try this instead::

os.environ['PATH'] += ';' + PSSE

I get the same error message trying to load a case when my environment was bad.

chip's avatar
459
chip
answered 2012-06-12 15:28:43 -0500, updated 2012-06-12 15:30:44 -0500
edit flag offensive 0 remove flag delete link

Comments

Yes, this definitely fixed the same problem. Cheers.

JervisW's avatar JervisW (2012-06-13 01:14:39 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer