Search code examples
pythonwindowscmdputty

Pipe PuTTY console to Python script


I am trying to launch a PuTTY window that establishes a serial connection, and then have the main cmd window (the one that launched my Python script) control the PuTTY window. The PuTTY window will still be open and showing everything, but I want to disable the stdin on it and just have it get the input from the cmd shell.

So I have it successfully launching the PuTTY window, just cant seem to pipe my outputs and inputs like I want. Any help would be greatly appreciated!

Code for launching PuTTY window:

pty=subprocess.Popen(cmd,stdin=subprocess.PIPE,stdout=subprocess.PIPE)

Solution

  • PuTTY is a GUI application. It is not designed for automation.

    For automation, use the Plink, PuTTY command-line utility. It is a console application, so it reads commands from its standard-input.

    See: