Ask Your Question

Caspy breaks Python

asked 2017-08-02 23:42:23 -0600

Ali gravatar image

updated 2017-08-02 23:44:38 -0600

Hello, I have done a range of tasks using psspy. I can also import caspy successfully, import caspy ; however, when I try to read a saved case using sample = caspy.Savecase(r'path/to/examples/savnw.sav') , Python stops working and I get the infamous window of "Python has stopped working." What do you think is the problem?

  1. The psspy functions work perfectly.
  2. PSSE 34
  3. I am running Python 2.7.9 from PSSE Command Prompt, on Windows 7

Any help is appreciated.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2017-08-03 19:36:55 -0600

mbong gravatar image

updated 2017-08-03 19:37:50 -0600

This has been a problem which seemingly is supposed to have been fixed (according to the PTI engineer in version > 33). I had to rewrite Gridcompare into PSSEcompare to handle it. you can download and see the code that somewhat handles it: by forking a process seeing if it crashes (meaning bad caspy) and uses another accessor library.

edit flag offensive delete link more


Thank you. I had seen the PSSECompare before, however, I don't know how to use it here to fix this issue. Would you care to elaborate?

Ali gravatar imageAli ( 2017-08-03 20:49:33 -0600 )edit

if you have a bad caspy with your PSSE installation the only other way is to use psspy. I have more detailed explanation of the problem and solution in my PSSEcompare page in the readme file. There is no workarond to caspy except updating psse

mbong gravatar imagembong ( 2017-08-04 00:47:24 -0600 )edit

I have tried to make the python code as simple as possible (one of the main reason for writing the utility)

mbong gravatar imagembong ( 2017-08-04 00:58:06 -0600 )edit

I tested caspy on PSSE v.33.10, running from the GUI and from python: It works as expected using a v.33 sav case When 'loading' a previous version (v.32) sav case, it did not crash but it gave an error.

jconto gravatar imagejconto ( 2017-08-04 10:41:39 -0600 )edit

Well that confirms that they fixed it. I think I was told v 33.09 as the version that fixed it by PTI.

mbong gravatar imagembong ( 2017-08-04 11:59:13 -0600 )edit

answered 2017-08-03 08:19:19 -0600

jconto gravatar image

I tested caspy on PSSE v.34.2, running from the GUI and from python:

  • It works as expected using a v.34 sav case
  • When 'loading' a previous version (v.32) sav case, it did not crash but it gave truncated data, like not being picked up from the right location. (due to different version internal formatting!?).

    import psse34

    import caspy

    sample = caspy.Savecase('savnw34.sav')

    print sample.pssznm

edit flag offensive delete link more


Thank you, but this is what I have been doing and every time I do it, Python stops working. Any other ideas?

Ali gravatar imageAli ( 2017-08-03 17:51:35 -0600 )edit

are you using PSSe v.34.2? is your sav case a v.34 case?

jconto gravatar imagejconto ( 2017-08-03 19:55:52 -0600 )edit

I am using PSSE Version 34.0.0 April 23rd, 2015 (RC8). I am using the case file that is provided with the software. The savnw.sav file was last edited April 16, 2015, which makes me think they must be from the same version.

Ali gravatar imageAli ( 2017-08-03 20:47:42 -0600 )edit

I had submitted the bug to PTI about a year ago and the tech engineer rather brusquely told me it was fixed in version 33.9 and asked me to update. However my company only paid for the onetime v33.1 so I am stuck with that buggy version.

mbong gravatar imagembong ( 2017-08-04 00:52:36 -0600 )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

1 follower


Asked: 2017-08-02 23:42:23 -0600

Seen: 473 times

Last updated: Aug 03 '17