I’d like to use paramiko to run a command and exit when a pattern appears. Now I do it using pexpect.expect(..., pattern = [pattern1, pattern2,...])
Is there a way to do using paramiko?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, I don’t think paramiko has that capability. In my experience the best approach is to send the pexpect script to the remote and execute it there with your paramiko. Fabric users run into this issue sometimes: https://stackoverflow.com/a/10007635/708221