Expect() from telnetlib giving me problems.
wurmy at earthlink.net
Fri Sep 13 04:11:53 CEST 2002
> File "C:\python22\lib\telnetlib.py", line 541, in expect
> list[i] = re.compile(list[i])
> File "C:\Python22\lib\sre.py", line 178, in compile
> return _compile(pattern, flags)
> File "C:\Python22\lib\sre.py", line 228, in _compile
> raise error, v # invalid expression
> error: nothing to repeat
Note that this is an error in sre.py, not in telnetlib. (A clue! ;-)
> I've tried several different ways to get the expect command to work. I
> can't find any examples and only limited documentation. Here is how
> I'm trying to implement it:
> alist = [ 'COMPLD', '*/' ]
> buffer = conn.expect(alist, 5)
> Can someone please tell me what is wrong or provide me with some
> working examples of using the command.
expect() expects a list of regular expressions. '*/' probably isn't a valid
regex. See also
Read until one from a list of a regular expressions matches.
The first argument is a list of regular expressions, either compiled
(re.RegexObject instances) or uncompiled (strings). The optional second
argument is a timeout, in seconds; the default is to block indefinitely.
# decode for email address ;-)
The Pythonic Quarter:: http://www.awaretek.com/nowak/
More information about the Python-list