Sudden Problem with pexpect - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Sudden Problem with pexpect (/thread-35586.html) |
Sudden Problem with pexpect - gw1500se - Nov-19-2021 I have a script the uses pexpect that has been working for years (common story, right?) that suddenly is failing. When I run the command manually I first get a prompt for 'Username'. When I run the pexpect script I get a trace back. proc=pexpect.spawn('/usr/sbin/openvpn '+config) proc.expect('Username:') One thing I noticed is that the username prompt is in bold. (not sure if it has always been that way) I don't think that would cause the problem but I though I'd mention it. If that somehow changed the string so it doesn't match I would expect a different error.I could probably figure this out if I understood what this traceback was telling me. Can someone interpret it for me? TIA. RE: Sudden Problem with pexpect - bowlofred - Nov-19-2021 It was reading from the program trying to find your expected string. But then the program gave back an EOF (it exited). And the last few things that it received before exiting was: Quote: d *BEFORE* this. Do you recognize the output? Can your openvpn produce that output somehow? I suspect that the stuff in config is making the command line invalid and it's just showing you the usage information rather than spawning.
RE: Sudden Problem with pexpect - gw1500se - Nov-19-2021 Hmm. That is not what I get from manually launching. Thanks. At least you gave me a direction to look. RE: Sudden Problem with pexpect - bowlofred - Nov-19-2021 (Nov-19-2021, 04:56 PM)gw1500se Wrote: Hmm. That is not what I get from manually launching. Thanks. At least you gave me a direction to look. What is the content of config ?Can you just see something happen with import subprocess ... print(subprocess.getoutput('/usr/sbin/openvpn '+config)) |