6821: CLI asks forever when trying to overwrite while exporting

svn: r22542
This commit is contained in:
Paul Franklin 2013-06-20 16:34:22 +00:00
parent aa7516cbb4
commit f3fc5c5257

View File

@ -8,7 +8,7 @@
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012 Doug Blank
# Copyright (C) 2012 Paul Franklin
# Copyright (C) 2012-2013 Paul Franklin
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -286,23 +286,20 @@ class ArgHandler(object):
self.__error(_("WARNING: Output file already exists!\n"
"WARNING: It will be overwritten:\n %s") %
fullpath)
answer = None
while not answer:
try:
if sys.version_info[0] < 3:
ask = raw_input
else:
ask = input
ans = ask(_('OK to overwrite? (yes/no) '))
except EOFError:
print()
sys.exit(0)
if ans.upper() in ('Y', 'YES', _('YES').upper()):
self.__error(_("Will overwrite the existing file: %s")
% fullpath)
answer = "ok"
try:
if sys.version_info[0] < 3:
ask = raw_input
else:
sys.exit(0)
ask = input
answer = ask(_('OK to overwrite? (yes/no) '))
except EOFError:
print()
sys.exit(0)
if answer.upper() in ('Y', 'YES', _('YES').upper()):
self.__error(_("Will overwrite the existing file: %s")
% fullpath)
else:
sys.exit(0)
if family_tree_format is None:
# Guess the file format based on the file extension.