##// END OF EJS Templates
Fix IPython.utils.warn API so messages are automatically displayed followed by a newline.
Thomas Kluyver -
Show More
@@ -137,7 +137,7 b' class HistoryAccessor(Configurable):'
137 137 self.hist_file = self._get_hist_file_name(profile)
138 138
139 139 if sqlite3 is None and self.enabled:
140 warn("IPython History requires SQLite, your history will not be saved\n")
140 warn("IPython History requires SQLite, your history will not be saved")
141 141 self.enabled = False
142 142
143 143 if sqlite3 is not None:
@@ -336,7 +336,7 b' class InteractiveShell(SingletonConfigurable):'
336 336 'prompt_out' : 'out_template',
337 337 'prompts_pad_left' : 'justify',
338 338 }
339 warn("InteractiveShell.{name} is deprecated, use PromptManager.{newname}\n".format(
339 warn("InteractiveShell.{name} is deprecated, use PromptManager.{newname}".format(
340 340 name=name, newname=table[name])
341 341 )
342 342 # protect against weird cases where self.config may not exist:
@@ -721,7 +721,7 b' class InteractiveShell(SingletonConfigurable):'
721 721 return
722 722
723 723 warn("Attempting to work in a virtualenv. If you encounter problems, please "
724 "install IPython inside the virtualenv.\n")
724 "install IPython inside the virtualenv.")
725 725 if sys.platform == "win32":
726 726 virtual_env = os.path.join(os.environ['VIRTUAL_ENV'], 'Lib', 'site-packages')
727 727 else:
@@ -351,7 +351,7 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):'
351 351 """Replace --pylab='inline' with --pylab='auto'"""
352 352 if new == 'inline':
353 353 warn.warn("'inline' not available as pylab backend, "
354 "using 'auto' instead.\n")
354 "using 'auto' instead.")
355 355 self.pylab = 'auto'
356 356
357 357 def start(self):
@@ -105,7 +105,7 b' class InputHookManager(object):'
105 105
106 106 def __init__(self):
107 107 if ctypes is None:
108 warn("IPython GUI event loop requires ctypes, %gui will not be available\n")
108 warn("IPython GUI event loop requires ctypes, %gui will not be available")
109 109 return
110 110 self.PYFUNC = ctypes.PYFUNCTYPE(ctypes.c_int)
111 111 self._apps = {}
@@ -319,7 +319,7 b' def make_exclude():'
319 319 continue
320 320 fullpath = pjoin(parent, exclusion)
321 321 if not os.path.exists(fullpath) and not glob.glob(fullpath + '.*'):
322 warn("Excluding nonexistent file: %r\n" % exclusion)
322 warn("Excluding nonexistent file: %r" % exclusion)
323 323
324 324 return exclusions
325 325
@@ -130,9 +130,9 b' def import_fail_info(mod_name,fns=None):'
130 130 """Inform load failure for a module."""
131 131
132 132 if fns == None:
133 warn("Loading of %s failed.\n" % (mod_name,))
133 warn("Loading of %s failed." % (mod_name,))
134 134 else:
135 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
135 warn("Loading of %s from %s failed." % (fns,mod_name))
136 136
137 137
138 138 class NotGiven: pass
@@ -42,7 +42,7 b' def warn(msg,level=2,exit_val=1):'
42 42
43 43 if level>0:
44 44 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
45 io.stderr.write('%s%s' % (header[level],msg))
45 print(header[level], msg, sep='', file=io.stderr)
46 46 if level == 4:
47 47 print('Exiting.\n', file=io.stderr)
48 48 sys.exit(exit_val)
General Comments 0
You need to be logged in to leave comments. Login now