Using python flask and pexpect works on flask development server fails with WSGI
You probably just need to replace ssh with its full path, e.g. /usr/bin/ssh.
You can find the full path with which ssh.
I am writing a tool for internal use at work. A user enters a router or switch IP address, username and password into a web form. The app then uses pexpect to SSH into  the device, downloads a configuration and tests that the configuration complies with various standards by running true/false tests (e.g. hostname is set). Leaving aside whether this is a good idea or not, my problem is that when I run the program under the Flask development program it works fine. When I set it up to run under WSGI it fails at the SSH portion with the error:
pexpect.exceptions.ExceptionPexpect: The command was not found or was not executable: ssh.
I tried uWSGI and Unicorn and played with the number of workers etc. to no avail.
I suspect this is a setuid root thing. Google searches do not point to a solution. Can anyone lead me to a fix? If pexpect will not work, I may give up and require the user to upload a config file they save themselves but I am frustrated that this works on the flask development server but not a production server.