##// 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 24 import threading
25 25
26 26 # Our own packages
27 from IPython.core.error import StdinNotImplementedError
27 28 from IPython.config.configurable import Configurable
28 29 from IPython.external.decorator import decorator
29 30 from IPython.testing.skipdoctest import skip_doctest
@@ -797,7 +798,12 b" def magic_history(self, parameter_s = ''):"
797 798 close_at_end = False
798 799 else:
799 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 807 print('Aborting.')
802 808 return
803 809
@@ -45,6 +45,7 b' import IPython'
45 45 from IPython.core import debugger, oinspect
46 46 from IPython.core.error import TryNext
47 47 from IPython.core.error import UsageError
48 from IPython.core.error import StdinNotImplementedError
48 49 from IPython.core.fakemodule import FakeModule
49 50 from IPython.core.profiledir import ProfileDir
50 51 from IPython.core.macro import Macro
@@ -988,8 +989,11 b' Currently the magic system has the following functions:\\n"""'
988 989 if 'f' in opts:
989 990 ans = True
990 991 else:
991 ans = self.shell.ask_yes_no(
992 try:
993 ans = self.shell.ask_yes_no(
992 994 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ", default='n')
995 except StdinNotImplementedError:
996 ans = True
993 997 if not ans:
994 998 print 'Nothing done.'
995 999 return
@@ -1059,9 +1063,12 b' Currently the magic system has the following functions:\\n"""'
1059 1063 if opts.has_key('f'):
1060 1064 ans = True
1061 1065 else:
1062 ans = self.shell.ask_yes_no(
1066 try:
1067 ans = self.shell.ask_yes_no(
1063 1068 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ",
1064 1069 default='n')
1070 except StdinNotImplementedError:
1071 ans = True
1065 1072 if not ans:
1066 1073 print 'Nothing done.'
1067 1074 return
General Comments 0
You need to be logged in to leave comments. Login now