Ask Your Question
0

how to close an out file after it is opened in dyntools

asked 2020-07-24 11:13:02 -0600

Sidharth gravatar image

updated 2020-07-24 11:13:55 -0600

Hi, I am using dyntools to open a out file, below is the command which I am using:

chnfobj = dyntools.CHNF(outFile)

In PSSE 34.4 after running a python script with above line, I am not able to access the out files used by dyntools until I close the PSSE manually. I have not faced this issue in previous version like 34.2. Do we have any command which can be added to the python script to close the open file in dyntools so that the same out file can be accessed outside PSSE environment also without having the need to close PSSE.

Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-07-28 19:43:26 -0600

boat14 gravatar image

Try doing it with python's with statement:

with dyntools.CHNF(outFile) as chnfobj:
    # Do your operations here
# End of your script

Upon completion, the with statement will force the API's exit() method upon completion, if there is one.

I'm not 100% sure how thorough the PSS/e API is with enter() and exit() methods.

The API documentation does not list any exit() method so it also might be worth sending a support request to Siemens so they include one in the next version.

edit flag offensive delete link more

Comments

It seems CHNF does not have exit() with dyntools.CHNF(outfile_gen) as chnfobj: AttributeError: CHNF instance has no attribute '__exit__'

diodezener gravatar imagediodezener ( 2021-07-11 20:13:13 -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

Stats

Asked: 2020-07-24 11:13:02 -0600

Seen: 701 times

Last updated: Jul 28 '20