I am writing python script to automate some task in simulator... to connect to simulator command is telnet localhost <port>
.
This command I am giving through os.system(telnet localhost <port>)
.
It is working.
And simulator is running:
Trying ::1...
Connected to localhost.
Escape character is '^]'.
>
Now I have to give commands through python inside this but I can't inside this(>) I have to give..I used telnet commands but it didn't work.
#!/usr/bin/env python
import os,re,telnetlib
host = "localhost"
port = "1111"
tn = telnetlib.Telnet(host, port)
tn.write("exit")
This is sample code but it is not working.