*************************************************************************** IPython post-mortem report IPython version: 0.8.4 SVN revision : 128 Platform info : os.name -> posix, sys.platform -> linux2 *************************************************************************** Current user configuration structure: {'Version': 0, '__allownew': True, 'alias': [], 'args': [], 'autocall': 1, 'autoedit_syntax': 1, 'autoexec': [], 'autoindent': 1, 'automagic': 1, 'banner': 1, 'c': '', 'cache_size': 1000, 'classic': 0, 'color_info': 1, 'colors': 'Linux', 'confirm_exit': 1, 'debug': 0, 'deep_reload': 0, 'editor': '/usr/bin/vi', 'embedded': False, 'execfile': [], 'execute': [''], 'gthread': 0, 'help': 0, 'import_all': [], 'import_mod': [], 'import_some': [[]], 'include': [], 'interact': 0, 'ipythondir': '/home/mark/.ipython', 'log': 0, 'logfile': '', 'logplay': '', 'magic_docstrings': 0, 'messages': 1, 'multi_line_specials': 1, 'nosep': 0, 'object_info_string_level': 0, 'opts': Struct({'__allownew': True}), 'pdb': 0, 'pprint': 1, 'profile': '', 'prompt_in1': 'In [\\#]: ', 'prompt_in2': ' .\\D.: ', 'prompt_out': 'Out[\\#]: ', 'prompts_pad_left': 1, 'pylab': 0, 'pylab_import_all': 1, 'q4thread': 0, 'qthread': 0, 'quick': 0, 'quiet': 0, 'rcfile': 'ipythonrc', 'readline': 1, 'readline_merge_completions': 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', '"\\M-i": " "', '"\\M-o": "\\d\\d\\d\\d"', '"\\M-I": "\\d\\d\\d\\d"', '"\\C-r": reverse-search-history', '"\\C-s": forward-search-history', '"\\C-p": history-search-backward', '"\\C-n": history-search-forward', '"\\e[A": history-search-backward', '"\\e[B": history-search-forward', '"\\C-k": kill-line', '"\\C-u": unix-line-discard'], 'readline_remove_delims': '-/~', 'screen_length': -2, 'separate_in': '\n', 'separate_out': '', 'separate_out2': '', 'system_header': 'IPython system call: ', 'system_verbose': 0, 'term_title': 1, 'tk': 0, 'upgrade': 0, 'wildcards_case_sensitive': 1, 'wthread': 0, 'wxversion': '0', 'xmode': 'Context'} *************************************************************************** Crash traceback: --------------------------------------------------------------------------- AttributeError Python 2.5.2: /usr/bin/python Mon Jun 23 13:32:36 2008 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. /home/mark/ipy/usr/bin/ipython in () 12 IPython.Shell.IPShell().mainloop(sys_exit=1) 13 14 [or simply IPython.Shell.IPShell().mainloop(1) ] 15 16 and IPython will be your working environment when you start python. The final 17 sys.exit() call will make python exit transparently when IPython finishes, so 18 you don't have an extra prompt to get out of. 19 20 This is probably useful to developers who manage multiple Python versions and 21 don't want to have correspondingly multiple IPython versions. Note that in 22 this mode, there is no way to pass IPython any command-line options, as those 23 are trapped first by Python itself. 24 """ 25 26 import IPython.Shell ---> 27 IPython.Shell.start().mainloop() global IPython.Shell.start.mainloop = undefined 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 /usr/lib/python2.5/site-packages/ipython-0.8.4-py2.5.egg/IPython/Shell.pyc in mainloop(self=, sys_exit=0, banner=None) 69 #----------------------------------------------------------------------------- 70 # This class is trivial now, but I want to have it in to publish a clean 71 # interface. Later when the internals are reorganized, code that uses this 72 # shouldn't have to change. 73 74 class IPShell: 75 """Create an IPython instance.""" 76 77 def __init__(self,argv=None,user_ns=None,user_global_ns=None, 78 debug=1,shell_class=InteractiveShell): 79 self.IP = make_IPython(argv,user_ns=user_ns, 80 user_global_ns=user_global_ns, 81 debug=debug,shell_class=shell_class) 82 83 def mainloop(self,sys_exit=0,banner=None): ---> 84 self.IP.mainloop(banner) global by = undefined global the = undefined global IDL = undefined global stop = undefined global commands.R = undefined global c = undefined global C = undefined global s = undefined global i = undefined global d = undefined global t = undefined global _ = undefined global y = undefined global Wn = undefined global n = undefined global Xt = undefined 85 if sys_exit: 86 sys.exit() 87 88 #----------------------------------------------------------------------------- 89 def kill_embedded(self,parameter_s=''): 90 """%kill_embedded : deactivate for good the current embedded IPython. 91 92 This function (after asking for confirmation) sets an internal flag so that 93 an embedded IPython will never activate again. This is useful to 94 permanently disable a shell that is being called inside a loop: once you've 95 figured out what you needed from it, you may then kill it and the program 96 will then continue to run without the interactive shell interfering again. 97 """ 98 99 kill = ask_yes_no("Are you sure you want to kill this embedded instance " /usr/lib/python2.5/site-packages/ipython-0.8.4-py2.5.egg/IPython/iplib.pyc in mainloop(self=, banner="Python 2.5.2 (r252:60911, May 7 2008, 15:21:12)...ut 'object'. ?object also works, ?? prints more.\n") 1560 internally created default banner.""" 1561 1562 if self.rc.c: # Emulate Python's -c option 1563 self.exec_init_cmd() 1564 if banner is None: 1565 if not self.rc.banner: 1566 banner = '' 1567 # banner is string? Use it directly! 1568 elif isinstance(self.rc.banner,basestring): 1569 banner = self.rc.banner 1570 else: 1571 banner = self.BANNER+self.banner2 1572 1573 while 1: 1574 try: -> 1575 self.interact(banner) 1576 #self.interact_with_readline() 1577 # XXX for testing of a readline-decoupled repl loop, call interact_with_readline above 1578 1579 break 1580 except KeyboardInterrupt: 1581 # this should not be necessary, but KeyboardInterrupt 1582 # handling seems rather unpredictable... 1583 self.write("\nKeyboardInterrupt in interact()\n") 1584 1585 def exec_init_cmd(self): 1586 """Execute a command given at the command line. 1587 1588 This emulates Python's -c option.""" 1589 1590 #sys.argv = ['-c'] /usr/lib/python2.5/site-packages/ipython-0.8.4-py2.5.egg/IPython/iplib.pyc in interact(self=, banner="Python 2.5.2 (r252:60911, May 7 2008, 15:21:12)...ut 'object'. ?object also works, ?? prints more.\n") 1797 self.write('\n') 1798 self.exit() 1799 except bdb.BdbQuit: 1800 warn('The Python debugger has exited with a BdbQuit exception.\n' 1801 'Because of how pdb handles the stack, it is impossible\n' 1802 'for IPython to properly format this particular exception.\n' 1803 'IPython will resume normal operation.') 1804 except: 1805 # exceptions here are VERY RARE, but they can be triggered 1806 # asynchronously by signal handlers, for example. 1807 self.showtraceback() 1808 else: 1809 more = self.push(line) 1810 if (self.SyntaxTB.last_syntax_error and 1811 self.rc.autoedit_syntax): -> 1812 self.edit_syntax_error() 1813 1814 # We are off again... 1815 __builtin__.__dict__['__IPYTHON__active'] -= 1 1816 1817 def excepthook(self, etype, value, tb): 1818 """One more defense for GUI apps that call sys.excepthook. 1819 1820 GUI frameworks like wxPython trap exceptions and call 1821 sys.excepthook themselves. I guess this is a feature that 1822 enables them to keep running after exceptions that would 1823 otherwise kill their mainloop. This is a bother for IPython 1824 which excepts to catch all of the program exceptions with a try: 1825 except: statement. 1826 1827 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if /usr/lib/python2.5/site-packages/ipython-0.8.4-py2.5.egg/IPython/iplib.pyc in edit_syntax_error(self=) 1418 return 0 1419 # always pass integer line and offset values to editor hook 1420 self.hooks.fix_error_editor(e.filename, 1421 int0(e.lineno),int0(e.offset),e.msg) 1422 return True 1423 1424 def edit_syntax_error(self): 1425 """The bottom half of the syntax error handler called in the main loop. 1426 1427 Loop until syntax error is fixed or user cancels. 1428 """ 1429 1430 while self.SyntaxTB.last_syntax_error: 1431 # copy and clear last_syntax_error 1432 err = self.SyntaxTB.clear_err_state() -> 1433 if not self._should_recompile(err): 1434 return 1435 try: 1436 # may set last_syntax_error again if a SyntaxError is raised 1437 self.safe_execfile(err.filename,self.user_ns) 1438 except: 1439 self.showtraceback() 1440 else: 1441 try: 1442 f = file(err.filename) 1443 try: 1444 sys.displayhook(f.read()) 1445 finally: 1446 f.close() 1447 except: 1448 self.showtraceback() /usr/lib/python2.5/site-packages/ipython-0.8.4-py2.5.egg/IPython/iplib.pyc in _should_recompile(self=, e=ValueError('invalid \\x escape',)) 1386 1387 atexit.register(self.atexit_operations) 1388 del atexit 1389 1390 # Configure auto-indent for all platforms 1391 self.set_autoindent(self.rc.autoindent) 1392 1393 def ask_yes_no(self,prompt,default=True): 1394 if self.rc.quiet: 1395 return True 1396 return ask_yes_no(prompt,default) 1397 1398 def _should_recompile(self,e): 1399 """Utility routine for edit_syntax_error""" 1400 -> 1401 if e.filename in ('','','', 1402 '','', 1403 None): 1404 1405 return False 1406 try: 1407 if (self.rc.autoedit_syntax and 1408 not self.ask_yes_no('Return to editor to correct syntax error? ' 1409 '[Y/n] ','y')): 1410 return False 1411 except EOFError: 1412 return False 1413 1414 def int0(x): 1415 try: 1416 return int(x) AttributeError: 'exceptions.ValueError' object has no attribute 'filename' *************************************************************************** History of session input: unicode('some\xasda string') *** Last line of input (may not be in above history): unicode('some\xasda string')