First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
3

Invalid file type (OpnApplFil/OPNPTI) when saving

asked Apr 7 '12

JervisW gravatar image

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?

1 answer

Sort by » oldest newest most voted
2

answered Jun 12 '12

chip gravatar image

updated Jun 12 '12

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.

link

Comments

Yes, this definitely fixed the same problem. Cheers.

JervisW gravatar imageJervisW (Jun 13 '12)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

Stats

Asked: Apr 7 '12

Seen: 2,831 times

Last updated: Jun 12 '12