AttributeError: ‘str’ object has no attribute ‘seek’ using textfsm module in python

i getting the error AttributeError: ‘str’ object has no attribute ‘seek’,

from netmiko import ConnectHandler
from textfsm import *

cisco_device = { ‘device_type’ : ‘cisco_ios’, ‘ip’ : ‘x.x.x.x’, ‘username’:’xxxxx’, ‘password’:’****9′}
net_connect = ConnectHandler(**cisco_device)

fo=(“test.txt” , ‘w’)

output = net_connect.send_command(“show ip int brief”)

re_table = TextFSM(‘xr_show_int_br’,’r’)

data = re_table.ParseText(output)

print (output)
print(re_table.header)

for test in (re_table.header):
fo.write(test)

fo.write(“\n”)

for row in data:
for temp_row in data:
fo.write(temp_row)
fo.write(“\n”)

fo.close

 

Traceback (most recent call last):
File “/Users/gtomy200/Desktop/Py/test.py”, line 11, in <module>
re_table = TextFSM(‘xr_show_int_br’,’r’)
File “/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/textfsm.py”, line 549, in __init__
template.seek(0)
AttributeError: ‘str’ object has no attribute ‘seek’
can someone please help?

Add Comment


  • LATEST ANSWERS

  • 0 Answer(s)

    Write your answer

    By posting your answer, you agree to the privacy policy and terms of service.