Ask Your Question
3

Invalid file type (OpnApplFil/OPNPTI) when saving

asked 2012-04-07 03:56:01 -0500

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2012-06-12 15:28:43 -0500

chip gravatar image

updated 2012-06-12 15:30:44 -0500

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.

edit flag offensive delete link more

Comments

Yes, this definitely fixed the same problem. Cheers.

JervisW gravatar imageJervisW ( 2012-06-13 01:14:39 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Stats

Asked: 2012-04-07 03:56:01 -0500

Seen: 2,671 times

Last updated: Jun 12 '12