Python send control + Q then control + A (special keys)
Question: I need to send some special keystrokes and am unsure of how to do it.

I need to send `Ctrl` \+ `Q` followed by `Ctrl` \+ `A` to a terminal (I'm
using Paramiko).

i have tried

    
    
    shell = client.invoke_shell()
    
    shell.send(chr(10))
    time.sleep(5)
    shell.send(chr(13))
    
    shell.send('\x11')
    shell.send('\x01')
    
    print 'i tried'
    

I can see the two returns go in successfully, but then nothing, it doesnt quit
the picocom (also to note i have it the wrong way round, its expecting ctrl+a,
then ctrl+q)

if it helps this is the device
<http://www.cisco.com/c/en/us/td/docs/routers/access/interfaces/eesm/software/configuration/guide/4451_config.html#pgfId-1069760>

as you can see at step 2

    
    
    Step 2 Exit the session from the switch, press Ctrl-a and Ctrl-q from your keyboard:
    
    Switch# <type ^a^q>
    Thanks for using picocom
    Router#
    

UPDATE:

i have tried \x01\x16\x11\n but this returns

    
    
    Switch#
    Switch#
    *** baud: 9600
    *** flow: none
    *** parity: none
    *** databits: 8
    *** dtr: down
    
    Switch#
    

this looks like it could be another special command?


Answer: Just as assumption: maybe pseudoterminal would help

    
    
    import paramiko
    client = paramiko.SSHClient()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    client.connect(...)
    channel = сlient.get_transport().open_session()
    channel.get_pty()
    channel.settimeout(5)
    channel.exec_command('\x11\x01') 
    

