-1

Try to use python to call psse. but something wrong with importing dyntools.

from __future__ import division

import os, sys, math, csv, time
PSSPY_location = r'C:\Program Files (x86)\PTI\PSSE34\PSSPY27'
PSSE_location = r'C:\Program Files (x86)\PTI\PSSE34\PSSBIN'
sys.path.append(PSSPY_location)
os.environ['PATH'] += ';' + PSSPY_location
os.environ['PATH'] += ';' + PSSE_location

import socket
import struct
import numpy, copy

import initialize_mute as mt    # mute all psse outputs
# import psse34
import dyntools
import psspy
import redirect
import dyntools
  File ".\dyntools.py", line 51, in <module>
ImportError: No module named pssevrsn

Process finished with exit code 1

mrzrm
  • 926
  • 7
  • 19
Junwei Liu
  • 3
  • 1
  • 3

2 Answers2

0

The PSSE manual indicates you need to define PSSPY_location and PSSE_location in your script but here is another option to tell Python where your PSSE installation is.

Create a file with extension .pth, (e.g., __psspy__.pth) in the site-packages directory of your Python installation. This could likely be C:\Python27\Lib\site-packages\__psspy.pth__ for you. The contents of this file will simply be C:\Program Files (x86)\PTI\PSSE34\PSSPY27. Whenever you startup your python interpreter it will looks for paths contained in .pth files in this directory and will look for python modules in these locations when you make import statements.

Then your script should be the following:

import psse34
import psspy
import dyntools
import redirect

If you still can't import dyntools then make sure it is where it should be, i.e., C:\Program Files (x86)\PTI\PSSE34\PSSPY27\dyntools.pyc

For PSSE v34 remember to always do import psse34 before importing any other PSSE related python modules.

jeschwar
  • 1,286
  • 7
  • 10
0

I made a copy of pssevrsn from Bin directory to the Python27 directory and it didn't made errors for me. I hope it works for

Ersi Ago
  • 15
  • 1
  • 6