Python pexpect module's "spawn" class lets you interact with a spawned child process.
As per its official API documentation on http://pexpect.sourceforge.net/pexpect.html
*************************************************
The maxread attribute sets the read buffer size. This is maximum number
of bytes that Pexpect will try to read from a TTY at one time. Setting
the maxread size to 1 will turn off buffering. Setting the maxread
value higher may help performance in cases where large amounts of
output are read back from the child. This feature is useful in
conjunction with searchwindowsize.
The searchwindowsize attribute sets the how far back in the incomming
seach buffer Pexpect will search for pattern matches. Every time
Pexpect reads some data from the child it will append the data to the
incomming buffer. The default is to search from the beginning of the
imcomming buffer each time new data is read from the child. But this is
very inefficient if you are running a command that generates a large
amount of data where you want to match The searchwindowsize does not
effect the size of the incomming data buffer. You will still have
access to the full buffer after expect() returns.
************************************************** **
Now my problem lies in that fact that executing "expect()" function more than once just keep on appending to the spawn class buffer inspite of the fact that I have set "maxread" to 1 and "searchwindowsize" to 0 in the spawn class constructor.
child = pexpect.spawn(login_string, timeout=20,logfile=None,maxread=1,searchwindowsize =0)
Due to this, my program logic is not working correctly.
Can anyone please help me out quickly.....???
SOS
pls posts replies to ***********
-Thanks in advance,
Mohit