First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
I want to find all the .sav files in E:\007, and conver the generators and loads use cong( ) and conl( ) function, but there are some errors in the program I wrote, anyone can help me ?
Thank you very much!
import os,sys sys.path.append(r"C:\Program Files\PTI\PSSE33\PSSBIN") os.environ['PATH'] = r"C:\Program Files\PTI\PSSE33\PSSBIN;" + os.environ['PATH'] os.chdir(r"E:\007") import psspy import redirect import glob PYTHONPATH = r'C:\Program Files\PTI\PSSE33\EXAMPLE'
sys.path.append(PYTHONPATH) os.environ['PATH'] += ';' + PYTHONPATH
redirect.psse2py()
for CASE in glob.glob(os.path.join('E:\007\','*.sav')): psspy.psseinit(150000) psspy.case(CASE)
psspy.cong(0)
psspy.conl(0,1,1,[0,0],[0.0,0.0,0.0,0.0])
psspy.conl(0,1,2,[0,0],[0.0,0.0,0.0,0.0])
psspy.conl(0,1,3,[0,0],[0.0,0.0,0.0,0.0])
case_root = os.path.splitext(sys.argv[1])[0]
psspy.save(case_root + "_C.sav")
*Traceback (most recent call last): File "E:\007\21.py", line 32, in <module> case_root = os.path.splitext(sys.argv[1])[0] IndexError: list index out of range*
![]() | 2 | No.2 Revision |
I want to find all the .sav files in E:\007, and conver the generators and loads use cong( ) and conl( ) function, but there are some errors in the program I wrote, anyone can help me ?
Thank you very much!
import os,sys
sys.path.append(r"C:\Program Files\PTI\PSSE33\PSSBIN")
os.environ['PATH'] = r"C:\Program Files\PTI\PSSE33\PSSBIN;" + os.environ['PATH']
os.chdir(r"E:\007")
import psspy
import redirect
import glob
PYTHONPATH = r'C:\Program Files\PTI\PSSE33\EXAMPLE' Files\PTI\PSSE33\EXAMPLE'
sys.path.append(PYTHONPATH)
os.environ['PATH'] += ';' + PYTHONPATH
redirect.psse2py()
PYTHONPATH
redirect.psse2py()
for CASE in glob.glob(os.path.join('E:\007\','*.sav')):
glob.glob(os.path.join('E:\\007\\','*.sav')):
psspy.psseinit(150000)
psspy.case(CASE)
psspy.case(CASE)
psspy.cong(0)
psspy.conl(0,1,1,[0,0],[0.0,0.0,0.0,0.0])
psspy.conl(0,1,2,[0,0],[0.0,0.0,0.0,0.0])
psspy.conl(0,1,3,[0,0],[0.0,0.0,0.0,0.0])
case_root = os.path.splitext(sys.argv[1])[0]
psspy.save(case_root + "_C.sav")
There ERRORS are as follow:
*Traceback (most recent call last):
File "E:\007\21.py", line 32, in <module>
case_root = os.path.splitext(sys.argv[1])[0]
IndexError: list index out of range*
Anyone can help me to debug the Python program?
I want to find all the .sav files in E:\007, and conver the generators and loads use cong( ) and conl( ) function, but there are some errors in the program I wrote, anyone can help me ?
Thank you very much!
import os,sys
sys.path.append(r"C:\Program Files\PTI\PSSE33\PSSBIN")
os.environ['PATH'] = r"C:\Program Files\PTI\PSSE33\PSSBIN;" + os.environ['PATH']
os.chdir(r"E:\007")
import psspy
import redirect
import glob
PYTHONPATH = r'C:\Program Files\PTI\PSSE33\EXAMPLE'
sys.path.append(PYTHONPATH)
os.environ['PATH'] += ';' + PYTHONPATH
redirect.psse2py()
for CASE in glob.glob(os.path.join('E:\\007\\','*.sav')):
psspy.psseinit(150000)
psspy.case(CASE)
psspy.cong(0)
psspy.conl(0,1,1,[0,0],[0.0,0.0,0.0,0.0])
psspy.conl(0,1,2,[0,0],[0.0,0.0,0.0,0.0])
psspy.conl(0,1,3,[0,0],[0.0,0.0,0.0,0.0])
case_root = os.path.splitext(sys.argv[1])[0]
psspy.save(case_root + "_C.sav")
There ERRORS are as follow:
*Traceback
Traceback (most recent call last):
File "E:\007\21.py", line 32, in <module>
case_root = os.path.splitext(sys.argv[1])[0]
IndexError: list index out of range
*
range
whit loves you. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.