Python Forum
Integer Required for psspy function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Integer Required for psspy function
#1
The error in the code is
Error:
psspy.three_wnd_winding_data_3(from_,to,'%s'% last_bus,r"""1""",1,[_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f]) TypeError: an integer is required
I thought I already converted the string into an integer. I am confused. Because the other variables year_link, tla_2, min_value, max_value did not require me to use isinstance and isdigit. Does anyone know how to fix this and can explain to me why I have to convert the string for the last column of the excel sheet.


for row in data:
     year_link, from_,to,digit,name2,tla_2,min_value,max_value,last_bus = row[7:16]
     if isinstance(last_bus, str) and year_link==year and tla_2==location and last_bus.isdigit() is True:
         min_value=float(min_value)
         max_value=float(max_value)
         last_bus=int(last_bus)
         
         output = 'From Bus #: {}\tTo Bus #: {}\tLast Bus #: {}\t Area Station: {}\t VMIN: {} pu\tVMAX: {} pu\t'
         print(output.format(from_, to,last_bus,name2, min_value, max_value))
         print("\n")
         psspy.three_wnd_winding_data_3(from_,to, last_bus,r"""1""",1,[_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f]) 
     else:
         exit

Attached Files

Thumbnail(s)
   
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  write an integer to file using a function xvkxvo 4 3,106 Dec-10-2019, 11:27 PM
Last Post: xvkxvo
  Python function that uses a word as the encryption key, rather than an integer wak_stephanie 4 4,771 Aug-31-2018, 12:16 PM
Last Post: perfringo
  datetime.date() - TypeError: an integer is required (got type str) bisoftware 7 30,816 Jan-30-2018, 08:05 PM
Last Post: buran
  Error "an integer is required" in getpass.getuser(). Nirelg 5 5,395 Mar-20-2017, 04:19 AM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020