[Freeipa-devel] [PATCH] Added try/except for error handling ipautil
Martin Basti
mbasti at redhat.com
Thu Aug 13 13:38:01 UTC 2015
On 08/10/2015 01:47 PM, Abhijeet Kasurde wrote:
> Hi All,
>
> This patch fixes bug - https://fedorahosted.org/freeipa/ticket/3406
>
> Thanks,
> Abhijeet Kasurde
>
>
Hello,
thank you for the patch
1)
- except ValueError:
+ except EOFError, ValueError:
Please use
except (EOFError, ValueError):
https://docs.python.org/2/tutorial/errors.html#handling-exceptions
2)
I'm not sure if this code will work (I did not test it)
I expect when stdin is closed, this will result into infinite loop,
because raw_input will always return EOFError.
while True:
try:
ret = raw_input("%s: " % prompt)
if allow_empty or ret.strip():
return ret
except EOFError:
pass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20150813/dacb3916/attachment.htm>
More information about the Freeipa-devel
mailing list