When running the following code in terminal:
import getpass
import sys
import telnetlib
import time
user = input("Please Enter Your Username: ")
password = input("Please Enter Your Password: ")
ip = input("Please Enter RPi IP Address: ")
bot = telnetlib.Telnet(ip)
bot.read_until("login: ")
bot.write(user + "\n")
bot.read_until("password: ")
bot.write(password + "\n")
I get an error message saying:
Traceback (most recent call last):
File "con.py", line 6, in <module>
use = input("Please Enter Your Username: ")
File "<string>", line 1, in <module>
NameError: name 'pi' is not defined
P.S pi
is what was fed to the variable user
. It runs in python shell(until it gets to the telnet part but then it would obviously doesn't work in the shell). why wouldn't it run in the terminal?
Thanks