<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<br>
<div class="moz-cite-prefix">On 08/14/2015 06:57 AM, Abhijeet
Kasurde wrote:<br>
</div>
<blockquote cite="mid:55CD7524.9080307@redhat.com" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<br>
<div class="moz-cite-prefix">On 08/13/2015 07:08 PM, Martin Basti
wrote:<br>
</div>
<blockquote cite="mid:55CC9DB9.5000705@redhat.com" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<br>
<br>
<div class="moz-cite-prefix">On 08/10/2015 01:47 PM, Abhijeet
Kasurde wrote:<br>
</div>
<blockquote cite="mid:55C88F57.6000500@redhat.com" type="cite">Hi
All, <br>
<br>
This patch fixes bug - <a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="https://fedorahosted.org/freeipa/ticket/3406">https://fedorahosted.org/freeipa/ticket/3406</a>
<br>
<br>
Thanks, <br>
Abhijeet Kasurde <br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
Hello,<br>
<br>
thank you for the patch<br>
<br>
1)<br>
- except ValueError:<br>
+ except EOFError, ValueError:<br>
<br>
Please use <br>
except (EOFError, ValueError):<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://docs.python.org/2/tutorial/errors.html#handling-exceptions">https://docs.python.org/2/tutorial/errors.html#handling-exceptions</a><br>
</blockquote>
OK, I will include this.<br>
<blockquote cite="mid:55CC9DB9.5000705@redhat.com" type="cite"> 2)<br>
I'm not sure if this code will work (I did not test it)<br>
<br>
I expect when stdin is closed, this will result into infinite
loop, because raw_input will always return EOFError.<br>
<br>
while True:<br>
try:<br>
ret = raw_input("%s: " % prompt)<br>
if allow_empty or ret.strip():<br>
return ret<br>
except EOFError:<br>
pass<br>
<br>
</blockquote>
Could you please elaborate more on, so that I can include fix in
this section of code?<br>
</blockquote>
If you receive EOF you cannot continue in while cycle because, it
will return EOF every iteration forever.<br>
<br>
If EOF is received the while cycle must end, and appropriate action
must be take.<br>
It depends on situation, if default value is present then default
value should be used, or in case if empty value is allowed, empty
string should be returned.<br>
<br>
In case there is no default value and empty value is not allowed,
then an exception should be raised.<br>
<br>
Martin^2<br>
</body>
</html>