[Tutor] Same code has different result

Dave Angel d at davea.name
Sun Feb 12 18:28:17 CET 2012


On 02/12/2012 12:02 PM, Andreas Perstinger wrote:
> [You've forgot to include the list in your reply]
>
> On Mon, 13 Feb 2012 00:04:54 +0800 daedae11<daedae11 at 126.com>  wrote:
>
>> Sorry, I'm not sure I know your viewpoint. Could you give me a
>> detailed explanation about "you need more than about 6-7 seconds (on
>> my computer) to type the third line."? Thank you very much.
> The comment in "nntplib.py" says that if the connection is closed, an "EOFError" will be raised (that's the error you get).
>
> In the interpreter you type in first the line "s = NNTP('news.gmane.org')" which opens the connection. Then you type in the "s.group"-line which is rather long and you are probably not typing fast enough. Meanwhile the connection to the gmane-Server is closed and that's why you get the "EOFError".
>
> In your script there is no problem because there is no delay between those two lines.
>
> Try to copy the lines of your script into your interpreter shell and you shouldn't get the error (don't type them manually, use copy&  paste!).
>
> HTH, Andreas
>


Or write them in a function, so it doesn't get run at all till you call it.




-- 

DaveA



More information about the Tutor mailing list