Reputation: 40140
I am coding a script interpreter. It should generate a Telnet session to send AT commands.
Here is the script which it generated:
telentHandle = None
if telentHandle == None:
import telnetlib
telentHandle = telnetlib.Telnet(10.49.188.187, 23456)
telentHandle.read_until("login: ")
telentHandle.write(userName + "\n")
telentHandle.read_until("Password: ")
telentHandle.write(password + "\n")
telentHandle.write(AT + "\n")
When I run it, I get
File "H:/code/testgen/test_script.txt.py", line 10
telentHandle = telnetlib.Telnet(10.49.188.187, 23456)
^
SyntaxError: invalid syntax
What am I doing wrongly?
Upvotes: 0
Views: 583
Reputation: 599460
10.49.188.187
isn't a valid identifier in Python (or any language). You presumably need a string: "10.49.188.187"
.
Upvotes: 2