First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

dyntools.CHNF TypeError: sequence item 0: expected string, int found

asked Oct 18 '19

xinya gravatar image

In python script: chnf = dyntools.CHNF(outfile,outvrsn=0)

The full error message :

File ".\dyntools.py", line 1411, in init

File ".\dyntools.py", line 247, in init

TypeError: sequence item 0: expected string, int found

What may cause this problem? Thank you

3 answers

Sort by » oldest newest most voted
0

answered Oct 21 '19

xinya gravatar image

Thank you all for replying.

It is not caused by either outfile (str) and outvrsn(int), they are both in correct format. I can be sure about that. This script was developed for years and tests with numerous systems. It is the first time we got this error. And there must be some issues in the dynamic run embedded in outfile causing this problem. I will update if I find the bug.

BTW, is there a good manual for dyntools? I am not able to find one.

link

Comments

import dyntools help('dyntools') It used to print the docstring out in the Python terminal. After reading your reply I now suspect Siemens changed something or what not...

drsgao gravatar imagedrsgao (Oct 21 '19)

HI , I just came across this questions and answers. Compare to Dyntools in version 33.4 , PTI has drastically changed it in version 34.6. Instead of upgrading and adding more function some of them have been deleted. Any script developed for V33 should be revised for V34.

Clarck gravatar imageClarck (Nov 14 '19)
0

answered Oct 23 '19

GaryB gravatar image

updated Oct 23 '19

It says sequence item 0 which may be the first argument. I think there’s an issue with setting outfile higher in the code. Check the variable type of it, should be string like it says. I think outvrsn looks fine for 33.12.

link

Comments

By the way, when things to do with file access abruptly stop working, it’s often a file permissions issue. I don’t know about your situation but just a thought.

GaryB gravatar imageGaryB (Oct 23 '19)
0

answered Oct 18 '19

drsgao gravatar image

Looks like it needs a string, i.e., '0' , and you gave it an int, i.e., 0.

By the way, what version is you PSSE?

link

Comments

Thanks for the reply. Yes, I knew it is caused by some mixing of string and int in the out file. But I am not able to locate it according to the error message: File ".\dyntools.py", line 1411, in init File ".\dyntools.py", line 247, in init Any suggestion?

xinya gravatar imagexinya (Oct 18 '19)

I don't think it is in the OUT file. I think you are giving the method an int argument instead of a string argument, thus the TypeError. Try this: chnf = dyntools.CHNF(outfile, outvrsn='0'). You need to put quotes around the zero to make it a string.

drsgao gravatar imagedrsgao (Oct 18 '19)

var outvrsn takes an INT, so my guess is that var outfile was giving an INT while expecting a STR.

jconto gravatar imagejconto (Oct 19 '19)

@jconto I think this should be the answer. By the way, the "outvrsn" argument is added in v34? I don't see it in v33.4.

drsgao gravatar imagedrsgao (Oct 21 '19)

I think it was added in v33.11. I am using the latest v. 33.12.1

jconto gravatar imagejconto (Oct 22 '19)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Oct 18 '19

Seen: 1,010 times

Last updated: Oct 22 '19