*************************************************************************** IPython post-mortem report IPython version: 0.2.15pre3 *************************************************************************** Current user configuration structure: {'Version': 0, 'alias': [], 'args': [], 'autocall': 1, 'automagic': 1, 'banner': 1, 'cache_size': 1000, 'classic': 0, 'color_info': 0, 'colors': 'Linux', 'confirm_exit': 1, 'debug': 0, 'deep_reload': 0, 'editor': 'jed', 'execfile': [], 'execute': [], 'help': 0, 'import_all': [], 'import_mod': [], 'import_some': [[]], 'include': [], 'ipythondir': '/home/prabhu/.ipython', 'log': 0, 'logfile': '', 'logplay': '', 'magic_docstrings': 0, 'messages': 1, 'nosep': 0, 'opts': Struct({}), 'pdb': 0, 'pprint': 1, 'profile': '', 'prompt_in1': 'In [%n]:', 'prompt_in2': ' .%n.:', 'prompt_out': 'Out[%n]:', 'quick': 0, 'rcfile': 'ipythonrc', 'readline': 1, 'readline_omit__names': 0, 'readline_parse_and_bind': ['tab: complete', '"\\C-l": possible-completions', 'set show-all-if-ambiguous on', '"\\C-o": tab-insert', '"\\C-r": reverse-search-history', '"\\C-s": forward-search-history', '"\\C-p": history-search-backward', '"\\C-n": history-search-forward'], 'readline_remove_delims': '\'"[]{}-/~', 'screen_length': -2, 'separate_in': '\n', 'separate_out': '', 'separate_out2': '', 'upgrade': 0, 'xmode': 'Context'} *************************************************************************** Crash traceback: --------------------------------------------------------------------------- NameError Python 2.2.1: /usr/bin/python Sat May 17 08:36:06 2003 A problem occured executing Python code. Here is the sequence of function calls leading up to the error, with the most recent (innermost) call last. /usr/local/bin/ipython -3 """ -2 -1 import IPython 0 IPython.Shell.IPShell().mainloop() /usr/local/lib/python2.2/site-packages/IPython/Shell.py in mainloop(self=, sys_exit=0) 28 29 #----------------------------------------------------------------------------- 30 # This class is trivial now, but I want to have it in to publish a clean 31 # interface. Later when the internals are reorganized, code that uses this 32 # shouldn't have to change. 33 34 class IPShell: 35 """Create an IPython instance.""" 36 37 def __init__(self,argv=None,user_ns=None,debug=0): 38 if argv is None: 39 argv = sys.argv 40 self.IP = make_IPython(argv,user_ns=user_ns,debug=debug) 41 42 def mainloop(self,sys_exit=0): ---> 43 self.IP.mainloop() self = , global IP = undefined, global mainloop = undefined 44 if sys_exit: 45 sys.exit() 46 47 # alias for backwards compatibility 48 IPythonShell = IPShell 49 50 #----------------------------------------------------------------------------- 51 class IPShellEmbed: 52 """Allow embedding an IPython shell into a running program. 53 54 Instances of this class are callable, with the __call__ method being an 55 alias to the embed() method of an InteractiveShell instance. 56 57 Usage (see also the example-embed.py file for a running example): 58 /usr/local/lib/python2.2/site-packages/IPython/iplib.py in mainloop(self=) 596 597 def update_cache(self, line): 598 """puts line into cache""" 599 self.inputcache.insert(0, line) # This copies the cache every time ... :-( 600 if len(self.inputcache) >= self.CACHELENGTH: 601 self.inputcache.pop() # This not :-) 602 603 def name_space_init(self): 604 """Create local namespace.""" 605 # We want this to be a method to facilitate embedded initialization. 606 code.InteractiveConsole.__init__(self,self.user_ns) 607 608 def mainloop(self): 609 """Creates the local namespace and starts the mainloop""" 610 self.name_space_init() --> 611 self.interact(self.BANNER) self = , global interact = undefined, global BANNER = undefined 612 self.exit_cleanup() 613 614 def exit_cleanup(self): 615 """Cleanup actions to execute at exit time.""" 616 for tfile in self.tempfiles: 617 try: 618 os.unlink(tfile) 619 except OSError: 620 pass 621 622 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0): 623 """Embeds IPython into a running python program. 624 625 Input: 626 /usr/local/lib/python2.2/site-packages/IPython/iplib.py in interact(self=, banner='Python 2.2.1 (#1, Sep 7 2002, 14:34:30) \nType "...ut \'object\'. ?object also works, ?? prints more.\n') 743 print 'OK.' 744 745 self.showtraceback() 746 747 # If the problem wasn't a broken out/err, it may be a bug 748 if not fix_out_err: 749 warn(""" 750 The above exception has been trapped by IPython's 'last line of defense'. 751 752 It is likely a bug in IPython. Unless you are positive it is not, it's 753 probably best to close this IPython session. 754 755 IPython can now crash and generate a bug report for the developers. If you 756 choose to continue, there may be unexpected behavior. 757 """) --> 758 crash = ask_yes_no( crash = 1, global ask_yes_no = 759 'Do you want to let IPython crash and generate a bug report (y/n)?') 760 if crash: 761 raise 762 else: 763 print 'IPython will continue operating.' 764 765 # We are off again... 766 __builtin__.__dict__['__IPYTHON__active'] -= 1 767 768 def runcode(self, code_obj): 769 """Execute a code object. 770 771 When an exception occurs, self.showtraceback() is called to 772 display a traceback. 773 """ /usr/local/lib/python2.2/site-packages/IPython/iplib.py in raw_input(self=, prompt=) 789 else: 790 if code.softspace(sys.stdout, 0): 791 print 792 793 def raw_input(self, prompt=""): 794 """Write a prompt and read a line. 795 796 The returned line does not include the trailing newline. 797 When the user enters the EOF key sequence, EOFError is raised. 798 799 The base implementation uses the built-in function 800 raw_input(); a subclass may replace this with a different 801 implementation. 802 """ 803 return self.prefilter(raw_input(prompt), --> 804 prompt==self.outputcache.prompt2) prompt = , self = , global outputcache = undefined, global prompt2 = undefined 805 806 def _prefilter(self, line, continue_prompt): 807 """Calls different preprocessors, depending on the form of line.""" 808 809 # All handlers *must* return a value, even if it's blank (''). 810 811 # Only normal lines are logged here. Handlers should process the line 812 # as needed, update the cache AND log it (so that the input cache 813 # array stays synced). 814 815 #if line.startswith('@crash'): raise 'Crash now!' # dbg 816 817 # save the line away in case we crash, so the post-mortem handler can 818 # record it 819 self._last_input_line = line /usr/local/lib/python2.2/site-packages/IPython/iplib.py in _prefilter(self=, line='example.cvar ', continue_prompt=0) 838 # First check for explicit escapes in the first character 839 line0 = line[0] 840 if line0 == self.ESC_SHELL: 841 return self.handle_shell_escape(line) 842 # Both ?word and word? go to help 843 elif line0 == self.ESC_HELP: 844 return self.handle_help(line[1:]) 845 elif line[-1] == self.ESC_HELP: 846 return self.handle_help(line[:-1]) 847 elif line0 == self.ESC_MAGIC: 848 return self.handle_magic(line) 849 elif line0 in self.ESC_QUOTE+self.ESC_PAREN: 850 return self.handle_auto(line0,iFun,theRest,line) 851 852 # Next, check if we can automatically execute this thing --> 853 oinfo = self._ofind(iFun.strip()) # FIXME - _ofind is part of Magic oinfo = undefined, self = , global _ofind = undefined, iFun = 'example.cvar ', global strip = undefined 854 855 if not oinfo['found']: 856 #print 'not found' # dbg 857 return self.handle_normal(line,continue_prompt) 858 859 if not oinfo['ismagic']: 860 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg 861 if self.rc.autocall and \ 862 (len(theRest)==0 or theRest[0] not in '!=()<>') and \ 863 self.fun_name.match(iFun) and \ 864 callable(oinfo['obj']) : 865 #print 'going auto' # dbg 866 #print 'fun match', self.fun_name.match(iFun) # dbg 867 return self.handle_auto(self.ESC_PAREN,iFun,theRest,line) 868 else: /usr/local/lib/python2.2/site-packages/IPython/Magic.py in _ofind(self=, oname='example.cvar') 284 # Play some games to try and find info about dotted objects 285 # and for things like {}.get? or ''.remove? to work 286 if not found: 287 try: 288 ns_test = namespaces[0] 289 self.tmp_obj = eval(oname,ns_test[1]) 290 found = 1 291 except: 292 try: 293 ns_test = namespaces[3] 294 self.tmp_obj = eval(oname,ns_test[1]) 295 found = 1 296 except: 297 pass 298 if found: --> 299 ds = inspect.getdoc(self.tmp_obj) ds = None, global inspect = , global getdoc = undefined, self = , global tmp_obj = undefined 300 ospace = ns_test[0] 301 obj = self.tmp_obj 302 del self.tmp_obj 303 304 #return found,obj,ospace,ds,ismagic 305 return {'found':found, 'obj':obj, 'namespace':ospace, 306 'docstring':ds, 'ismagic':ismagic} 307 308 def arg_err(self,func): 309 """Print docstring if incorrect arguments were passed""" 310 print 'Error in arguments:' 311 print inspect.getdoc(func) 312 313 314 def format_latex(self,str): /usr/lib/python2.2/inspect.py in getdoc(object=) 252 return tuple(result) 253 254 # -------------------------------------------------- source code extraction 255 def indentsize(line): 256 """Return the indent size, in spaces, at the start of a line of text.""" 257 expline = string.expandtabs(line) 258 return len(expline) - len(string.lstrip(expline)) 259 260 def getdoc(object): 261 """Get the documentation string for an object. 262 263 All tabs are expanded to spaces. To clean up docstrings that are 264 indented to line up with blocks of code, any whitespace than can be 265 uniformly removed from the second line onwards is removed.""" 266 try: --> 267 doc = object.__doc__ doc = undefined, object = , global __doc__ = 'Get useful information from live Python objects....info about frames on the stack or in a traceback\n' 268 except AttributeError: 269 return None 270 if not isinstance(doc, (str, unicode)): 271 return None 272 try: 273 lines = string.split(string.expandtabs(doc), '\n') 274 except UnicodeError: 275 return None 276 else: 277 margin = None 278 for line in lines[1:]: 279 content = len(string.lstrip(line)) 280 if not content: continue 281 indent = len(line) - content 282 if margin is None: margin = indent NameError: Unknown C global variable *************************************************************************** History of session input: import example *** Last line of input (may not be in above history): example.cvar