![]() |
Error f = open(r'D:\NetAuto\myswitches.txt') - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Networking (https://python-forum.io/forum-12.html) +--- Thread: Error f = open(r'D:\NetAuto\myswitches.txt') (/thread-26087.html) |
Error f = open(r'D:\NetAuto\myswitches.txt') - phutran - Apr-21-2020 Hi all, This is my code: import getpass import sys import telnetlib user = raw_input("Enter your telnet username: ") password = getpass.getpass() f = open(r'D:\NetAuto\myswitches.txt') for line in f: print "configuring Switch " + (line) HOST = line tn = telnetlib.Telnet(HOST) tn.read_until("Username: ") tn.write(user + "\n") if password: tn.read_until("Password: ") tn.write(password + "\n") tn.write("conf t\n") for n in range(40,51): tn.write("vlan " + str(n) + "\n") tn.write("name Python_VLAN_" + str(n) + "\n") tn.write("end\n") tn.write("wr\n") tn.write("exit\n") print tn.read_all()But there are error for the code: configuring Switch 192.168.1.101 Please help me this error
|