##// END OF EJS Templates
Improve error messages for line/cell magics.
Fernando Perez -
Show More
@@ -2027,12 +2027,11 class InteractiveShell(SingletonConfigurable):
2027 2027 """
2028 2028 fn = self.find_line_magic(magic_name)
2029 2029 if fn is None:
2030 em = "Line magic function `%%%s` not found" % magic_name
2031 2030 cm = self.find_cell_magic(magic_name)
2032 if cm is not None:
2033 em += (' (Did you by chance mean the cell magic `%%%%%s` '
2034 'instead?).')
2035 error()
2031 etpl = "Line magic function `%%%s` not found%s."
2032 extra = '' if cm is None else (' (But cell magic `%%%%%s` exists, '
2033 'did you mean that instead?)' % magic_name )
2034 error(etpl % (magic_name, extra))
2036 2035 else:
2037 2036 # Note: this is the distance in the stack to the user's frame.
2038 2037 # This will need to be updated if the internal calling logic gets
@@ -2053,7 +2052,11 class InteractiveShell(SingletonConfigurable):
2053 2052 """
2054 2053 fn = self.find_cell_magic(magic_name)
2055 2054 if fn is None:
2056 error("Cell magic function `%%%%%s` not found." % magic_name)
2055 lm = self.find_line_magic(magic_name)
2056 etpl = "Cell magic function `%%%%%s` not found%s."
2057 extra = '' if lm is None else (' (But line magic `%%%s` exists, '
2058 'did you mean that instead?)' % magic_name )
2059 error(etpl % (magic_name, extra))
2057 2060 else:
2058 2061 # Note: this is the distance in the stack to the user's frame.
2059 2062 # This will need to be updated if the internal calling logic gets
General Comments 0
You need to be logged in to leave comments. Login now