##// END OF EJS Templates
Don't ask for confirmation when stdin isn't available (i.e. in the notebook)...
Thomas Kluyver -
Show More
@@ -24,6 +24,7 b' except ImportError:'
24 import threading
24 import threading
25
25
26 # Our own packages
26 # Our own packages
27 from IPython.core.error import StdinNotImplementedError
27 from IPython.config.configurable import Configurable
28 from IPython.config.configurable import Configurable
28 from IPython.external.decorator import decorator
29 from IPython.external.decorator import decorator
29 from IPython.testing.skipdoctest import skip_doctest
30 from IPython.testing.skipdoctest import skip_doctest
@@ -797,7 +798,12 b" def magic_history(self, parameter_s = ''):"
797 close_at_end = False
798 close_at_end = False
798 else:
799 else:
799 if os.path.exists(outfname):
800 if os.path.exists(outfname):
800 if not io.ask_yes_no("File %r exists. Overwrite?" % outfname):
801 try:
802 ans = io.ask_yes_no("File %r exists. Overwrite?" % outfname)
803 except StdinNotImplementedError:
804 print("Overwriting file.")
805 ans = True
806 if not ans:
801 print('Aborting.')
807 print('Aborting.')
802 return
808 return
803
809
@@ -45,6 +45,7 b' import IPython'
45 from IPython.core import debugger, oinspect
45 from IPython.core import debugger, oinspect
46 from IPython.core.error import TryNext
46 from IPython.core.error import TryNext
47 from IPython.core.error import UsageError
47 from IPython.core.error import UsageError
48 from IPython.core.error import StdinNotImplementedError
48 from IPython.core.fakemodule import FakeModule
49 from IPython.core.fakemodule import FakeModule
49 from IPython.core.profiledir import ProfileDir
50 from IPython.core.profiledir import ProfileDir
50 from IPython.core.macro import Macro
51 from IPython.core.macro import Macro
@@ -988,8 +989,11 b' Currently the magic system has the following functions:\\n"""'
988 if 'f' in opts:
989 if 'f' in opts:
989 ans = True
990 ans = True
990 else:
991 else:
991 ans = self.shell.ask_yes_no(
992 try:
993 ans = self.shell.ask_yes_no(
992 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ", default='n')
994 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ", default='n')
995 except StdinNotImplementedError:
996 ans = True
993 if not ans:
997 if not ans:
994 print 'Nothing done.'
998 print 'Nothing done.'
995 return
999 return
@@ -1059,9 +1063,12 b' Currently the magic system has the following functions:\\n"""'
1059 if opts.has_key('f'):
1063 if opts.has_key('f'):
1060 ans = True
1064 ans = True
1061 else:
1065 else:
1062 ans = self.shell.ask_yes_no(
1066 try:
1067 ans = self.shell.ask_yes_no(
1063 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ",
1068 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ",
1064 default='n')
1069 default='n')
1070 except StdinNotImplementedError:
1071 ans = True
1065 if not ans:
1072 if not ans:
1066 print 'Nothing done.'
1073 print 'Nothing done.'
1067 return
1074 return
General Comments 0
You need to be logged in to leave comments. Login now