[Tutor] A problem in read_until(expected[,timeout])
Lloyd Kvam
pythonTutor at venix.com
Sat Sep 25 23:38:37 CEST 2004
I think this should work:
obj.read_until(timeout=10) # no expect string
or
obj.read_until("ten",10) # "ten" or 10 seconds
read_until is a method of the telnet object so your code should have the
name you gave the telnet object before the read_until. I used obj
simply to indicate there should be some name there.
The documentation can be confusing because it uses [] to mark optional
parameters while Python uses [] to mark lists.
When you do not need all of the arguments, you can specify the names of
the arguments that you want to use. That's why timeout=10 should work
in the first suggestion.
On Sat, 2004-09-25 at 17:04, W X Liu wrote:
> Hello,
>
> I want use read_until object to interact with telnet. The problem is that if I
> just want to match the expected string, then it will be fine. code would be
>
> read_until(expected)
>
> But if I want to just want to match the timeout seconds, I don't know how to
> write it.
>
> I code it as
>
> read_until([,seconds])
>
> Then invalid syntax occurs. Or if I add a expected string together with
> timeout, then I code it as
>
> read_until(ten [,10])
>
> ten is the string I want to match, and 10 is the expected timeout second,
> butinvalid syntax occurs again. So anyone can help me to solve this? Many thanks
>
>
> Wenxin
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Lloyd Kvam
Venix Corp
More information about the Tutor
mailing list