Search code examples
pythonsecure-crt

Can someone help me with a Python command for ctrl + c


I am running a python script on Secure CRT to capture certain data logs. My logs can be stopped by pressing ctrl+c physically on the keyboard. So far I have used the following but to no avail. Can someone tell me how to send ctrl+c as a command to secure CRT ?

  1. tab.Screen.Send("kill -2\n")

  2. import os
    import signal
    os.kill(p.pid,signal.SIGINT)
    

Solution

  • I found the answer. If anyone faces a similar issue in the future -

        tab.Screen.Send("\003")
    

    OR

        crt.Screen.Send("\003")