New submission from ptz <ppt...@gmail.com>:

In Python 2.4, Assuming we've imported telnetlib, the following works:

    >>> f = telnetlib.Telnet("some_text_based_server")
    >>> f.read_very_eager()

The last call outputs the text that the server outputs upon connection (e.g. 
"login: ").

However, if we put this inside a function it does not work:

    >>> def g():
    ...   f = telnetlib.Telnet("server")
    ...   data = f.read_very_eager()
    ...   print data
    ...
    >>> g()

This returns the empty string. I believe this indicates that the data from the 
server isn't cooked. 

Note that if we use read_until() instead of read_very_eager(), everything works 
as expected, further supporting the hypothesis that data doesn't cook properly 
when the functions are called as above.

So why the difference?

----------
components: Library (Lib)
messages: 119423
nosy: ptz
priority: normal
severity: normal
status: open
title: telnetlib.Telnet.read_very_eager() performance
type: behavior
versions: 3rd party

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10176>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to