I have this code below:
from pywinauto.application import Application
'''user-defined package user_input1'''
from user_input1 import Get_USER,Get_TOKEN
import time
server='host.domain.com'
cwd=r'C:\Program Files (x86)\PuTTY'
user = 'uname'
'''user = Get_USER()'''
password = Get_TOKEN()
app = Application().start(cmd_line='putty -ssh uname@host.domain.com')
putty = app.PuTTY
putty.wait('ready')
time.sleep(1)
putty.type_keys(password)
putty.type_keys("{ENTER}")
time.sleep(1)
putty.type_keys("export TMOUT=0")
putty.type_keys("{ENTER}")
This code works as expected. But when I change the line app = Application().start(cmd_line='putty -ssh uname@host.domain.com') to app = Application().start(cmd_line="putty -ssh user@server") i.e when I try to pass the variable names instead of the actual values, it is not able to make the connection because the user and server variables don't expand to their actual values.
How can I correctly pass the variables.