These are chat archives for pexpect/pexpect

27th
Oct 2015
mvensky
@mvensky
Oct 27 2015 00:28
Hello, I'm trying to get pexpect to deal with ncurses type output. The escapes cause the expect function to basically loose the search string. I can strip out the escape sequences, but now expect has lost the thread. I've Google'd around, hang out on IRC and others seem to have the same desire. Any suggestions? Jeff 1st suggested I come here.
Jeff Quast
@jquast
Oct 27 2015 00:51
hello
You mean, you wish to call child.expect(“vanilla string”), even though it may literally read, “\x1b[1;31mvanilla \x1b1;32mstring\x1b0m” ?
Jeff Quast
@jquast
Oct 27 2015 00:58
I lost you the first time in email about a “thread” — do you literally mean some use of the threading module? This is unclear
mvensky
@mvensky
Oct 27 2015 01:03
Sorry, no I meant that when you use pexpect to spawn an ncurses based process and then try to expect a string, if the string contains escapes "expect" fails. Actually, what I can see from the logs is that then entire screen gets sent to the single "expect" command. This "expect" commands fails to find the substring in the wash.
And yes, to your question about child.expect(“vanilla string”).
I'm going to drop off for a bit; got a one-hour drive home.
Jeff Quast
@jquast
Oct 27 2015 01:05
ok. I’ll provide an answer. briefly: possible, but difficult
mvensky
@mvensky
Oct 27 2015 01:07
Cool, I'll try to logon tonight or early tomorrow morning: I tend to goto bed early and get up the same.
that is my first recommendation, at least, I think the one you have in mind. My other recommendation would be to simply use the “ptyprocess” module (which pexpect uses), and write your own special-purpose expect api
depends on your familiarity
that’s about the most help i have the time to afford to give, good luck. I’m over here in california if you want to offer some us dollars to solve any python solution :) have a good winter, stay safe from el nino!