***************************************************************************
IPython post-mortem report
{'codename': 'An Afternoon Hack',
'commit_hash': '2b1d88b',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path': '/Applications/sage/local/lib/python2.7/site-packages/IPython',
'ipython_version': '1.2.1',
'os_name': 'posix',
'platform': 'Darwin-13.3.0-x86_64-i386-64bit',
'sys_executable': '/Applications/sage/local/bin/python',
'sys_platform': 'darwin',
'sys_version': '2.7.5 (default, May 6 2014, 16:48:46) \n[GCC 4.7.3]'}
***************************************************************************
***************************************************************************
Crash traceback:
---------------------------------------------------------------------------
OperationalError Python 2.7.5: /Applications/sage/local/bin/python
Fri Aug 22 15:03:36 2014
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.
/Applications/sage/src/bin/sage-ipython in <module>()
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 """
4 Sage IPython startup script.
5 """
6 from sage.repl.interpreter import SageTerminalApp
7
8 # installs the extra readline commands before the IPython
initialization begins.
9 from sage.repl.readline_extra_commands import *
10
11 app = SageTerminalApp.instance()
---> 12 app.initialize()
global app.initialize = <bound method SageTerminalApp.initialize of
<sage.repl.interpreter.SageTerminalApp object at 0x108d5c110>>
13 app.start()
/Applications/sage/local/lib/python2.7/site-packages/IPython/terminal/ipapp.pyc
in initialize(self=<sage.repl.interpreter.SageTerminalApp object>, argv=None)
/Applications/sage/local/lib/python2.7/site-packages/IPython/config/application.pyc
in catch_config_error(method=<function initialize>,
app=<sage.repl.interpreter.SageTerminalApp object>, *args=(None,), **kwargs={})
74
75
#-----------------------------------------------------------------------------
76 # Application class
77
#-----------------------------------------------------------------------------
78
79 @decorator
80 def catch_config_error(method, app, *args, **kwargs):
81 """Method decorator for catching invalid config
(Trait/ArgumentErrors) during init.
82
83 On a TraitError (generally caused by bad config), this will print
the trait's
84 message, and exit the app.
85
86 For use on init methods, to prevent invoking excepthook on invalid
input.
87 """
88 try:
---> 89 return method(app, *args, **kwargs)
method = <function initialize at 0x108d4fc80>
app = <sage.repl.interpreter.SageTerminalApp object at 0x108d5c110>
args = (None,)
kwargs = {}
90 except (TraitError, ArgumentError) as e:
91 app.print_help()
92 app.log.fatal("Bad config encountered during initialization:")
93 app.log.fatal(str(e))
94 app.log.debug("Config at the time: %s", app.config)
95 app.exit(1)
96
97
98 class ApplicationError(Exception):
99 pass
100
101 class LevelFormatter(logging.Formatter):
102 """Formatter with additional `highlevel` record
103
104 This field is empty if log level is less than highlevel_limit,
/Applications/sage/local/lib/python2.7/site-packages/IPython/terminal/ipapp.pyc
in initialize(self=<sage.repl.interpreter.SageTerminalApp object>, argv=None)
308
309 @catch_config_error
310 def initialize(self, argv=None):
311 """Do actions after construct, but before starting the app."""
312 super(TerminalIPythonApp, self).initialize(argv)
313 if self.subapp is not None:
314 # don't bother initializing further, starting subapp
315 return
316 if not self.ignore_old_config:
317 check_for_old_config(self.ipython_dir)
318 # print self.extra_args
319 if self.extra_args and not self.something_to_run:
320 self.file_to_run = self.extra_args[0]
321 self.init_path()
322 # create the shell
--> 323 self.init_shell()
self.init_shell = <bound method SageTerminalApp.init_shell of
<sage.repl.interpreter.SageTerminalApp object at 0x108d5c110>>
324 # and draw the banner
325 self.init_banner()
326 # Now a variety of things that happen after the banner is
printed.
327 self.init_gui_pylab()
328 self.init_extensions()
329 self.init_code()
330
331 def init_shell(self):
332 """initialize the InteractiveShell instance"""
333 # Create an InteractiveShell instance.
334 # shell.display_banner should always be False for the terminal
335 # based app, because we call shell.show_banner() by hand below
336 # so the banner shows *before* all extension loading stuff.
337 self.shell = TerminalInteractiveShell.instance(parent=self,
338 display_banner=False,
profile_dir=self.profile_dir,
/Applications/sage/local/lib/python2.7/site-packages/sage/repl/interpreter.pyc
in init_shell(self=<sage.repl.interpreter.SageTerminalApp object>)
511
512 This code is based on
513 :meth:`TermintalIPythonApp.init_shell`.
514
515 EXAMPLES::
516
517 sage: from sage.repl.interpreter import SageTerminalApp,
DEFAULT_SAGE_CONFIG
518 sage: app = SageTerminalApp(config=DEFAULT_SAGE_CONFIG)
519 sage: app.initialize(argv=[]) # indirect doctest
520 sage: app.shell
521 <sage.repl.interpreter.SageInteractiveShell object at 0x...>
522 """
523 # Shell initialization
524 self.shell = SageInteractiveShell.instance(config=self.config,
525 display_banner=False,
profile_dir=self.profile_dir,
--> 526 ipython_dir=self.ipython_dir)
global ipython_dir = undefined
self.ipython_dir = u'/Users/a3heinle/.sage/ipython-1.2.1'
527 self.shell.configurables.append(self)
528 self.shell.has_sage_extensions = SAGE_EXTENSION in
self.extensions
529
530 if self.shell.has_sage_extensions:
531 self.extensions.remove(SAGE_EXTENSION)
532
533 # load sage extension here to get a crash if
534 # something is wrong with the sage library
535 self.shell.extension_manager.load_extension(SAGE_EXTENSION)
/Applications/sage/local/lib/python2.7/site-packages/IPython/config/configurable.pyc
in instance(cls=<class 'sage.repl.interpreter.SageInteractiveShell'>,
*args=(), **kwargs={'config': {'ProfileDir': {}, 'SageTerminalApp':
{'force_in....: ', 'in_template': 'sage: ', 'justify': False}},
'display_banner': False, 'ipython_dir': u'/Users/a3heinle/.sage/ipython-1.2.1',
'profile_dir': <IPython.core.profiledir.ProfileDir object>})
334 >>> class Foo(SingletonConfigurable): pass
335 >>> foo = Foo.instance()
336 >>> foo == Foo.instance()
337 True
338
339 Create a subclass that is retrived using the base class
instance::
340
341 >>> class Bar(SingletonConfigurable): pass
342 >>> class Bam(Bar): pass
343 >>> bam = Bam.instance()
344 >>> bam == Bar.instance()
345 True
346 """
347 # Create and save the instance
348 if cls._instance is None:
--> 349 inst = cls(*args, **kwargs)
inst = undefined
cls = <class 'sage.repl.interpreter.SageInteractiveShell'>
args = ()
kwargs = {'ipython_dir': u'/Users/a3heinle/.sage/ipython-1.2.1',
'display_banner': False, 'config': {'ProfileDir': {}, 'SageTerminalApp':
{'force_interact': True}, 'TerminalInteractiveShell': {'separate_in': '',
'ast_node_interactivity': 'all', 'colors': 'NoColor', 'confirm_exit': False},
'InteractiveShellApp': {'extensions': ['sage']}, 'TerminalIPythonApp':
{'display_banner': False, 'verbose_crash': True}, 'PromptManager':
{'out_template': '', 'in2_template': '....: ', 'in_template': 'sage: ',
'justify': False}}, 'profile_dir': <IPython.core.profiledir.ProfileDir object
at 0x108d5c390>}
350 # Now make sure that the instance will also be returned by
351 # parent classes' _instance attribute.
352 for subclass in cls._walk_mro():
353 subclass._instance = inst
354
355 if isinstance(cls._instance, cls):
356 return cls._instance
357 else:
358 raise MultipleInstanceError(
359 'Multiple incompatible subclass instances of '
360 '%s are being created.' % cls.__name__
361 )
362
363 @classmethod
364 def initialized(cls):
/Applications/sage/local/lib/python2.7/site-packages/IPython/terminal/interactiveshell.pyc
in __init__(self=<sage.repl.interpreter.SageInteractiveShell object>,
config={'ProfileDir': {}, 'SageTerminalApp': {'force_in....: ', 'in_template':
'sage: ', 'justify': False}},
ipython_dir=u'/Users/a3heinle/.sage/ipython-1.2.1',
profile_dir=<IPython.core.profiledir.ProfileDir object>, user_ns=None,
user_module=None, custom_exceptions=((), None), usage=None, banner1=None,
banner2=None, display_banner=False, **kwargs={})
305 # Deferred import
306 from IPython.lib.inputhook import enable_gui as real_enable_gui
307 try:
308 return real_enable_gui(gui, app)
309 except ValueError as e:
310 raise UsageError("%s" % e)
311
312 def __init__(self, config=None, ipython_dir=None, profile_dir=None,
313 user_ns=None, user_module=None,
custom_exceptions=((),None),
314 usage=None, banner1=None, banner2=None,
display_banner=None,
315 **kwargs):
316
317 super(TerminalInteractiveShell, self).__init__(
318 config=config, ipython_dir=ipython_dir,
profile_dir=profile_dir, user_ns=user_ns,
319 user_module=user_module,
custom_exceptions=custom_exceptions,
--> 320 **kwargs
kwargs = {}
321 )
322 # use os.system instead of utils.process.system by default,
323 # because piped system doesn't make sense in the Terminal:
324 self.system = self.system_raw
325
326 self.init_term_title()
327 self.init_usage(usage)
328 self.init_banner(banner1, banner2, display_banner)
329
330
#-------------------------------------------------------------------------
331 # Overrides of init stages
332
#-------------------------------------------------------------------------
333
334 def init_display_formatter(self):
335 super(TerminalInteractiveShell, self).init_display_formatter()
/Applications/sage/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc
in __init__(self=<sage.repl.interpreter.SageInteractiveShell object>,
ipython_dir=u'/Users/a3heinle/.sage/ipython-1.2.1',
profile_dir=<IPython.core.profiledir.ProfileDir object>, user_module=None,
user_ns=None, custom_exceptions=((), None), **kwargs={'config': {'ProfileDir':
{}, 'SageTerminalApp': {'force_in....: ', 'in_template': 'sage: ', 'justify':
False}}})
441 self.init_create_namespaces(user_module, user_ns)
442 # This has to be done after init_create_namespaces because it
uses
443 # something in self.user_ns, but before init_sys_modules, which
444 # is the first thing to modify sys.
445 # TODO: When we override sys.stdout and sys.stderr before this
class
446 # is created, we are saving the overridden ones here. Not sure
if this
447 # is what we want to do.
448 self.save_sys_module_state()
449 self.init_sys_modules()
450
451 # While we're trying to have each part of the code directly
access what
452 # it needs without keeping redundant references to objects, we
have too
453 # much legacy code that expects ip.db to exist.
454 self.db = PickleShareDB(os.path.join(self.profile_dir.location,
'db'))
455
--> 456 self.init_history()
self.init_history = <bound method SageInteractiveShell.init_history of
<sage.repl.interpreter.SageInteractiveShell object at 0x108d5ce50>>
457 self.init_encoding()
458 self.init_prefilter()
459
460 self.init_syntax_highlighting()
461 self.init_hooks()
462 self.init_pushd_popd_magic()
463 # self.init_traceback_handlers use to be here, but we moved it
below
464 # because it and init_io have to come after init_readline.
465 self.init_user_ns()
466 self.init_logger()
467 self.init_alias()
468 self.init_builtins()
469
470 # The following was in post_config_initialization
471 self.init_inspector()
/Applications/sage/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc
in init_history(self=<sage.repl.interpreter.SageInteractiveShell object>)
1465 with self.builtin_trap:
1466 info = self._object_find(oname)
1467 if info.found:
1468 return self.inspector.info(info.obj, oname, info=info,
1469 detail_level=detail_level
1470 )
1471 else:
1472 return oinspect.object_info(name=oname, found=False)
1473
1474
#-------------------------------------------------------------------------
1475 # Things related to history management
1476
#-------------------------------------------------------------------------
1477
1478 def init_history(self):
1479 """Sets up the command history, and starts regular autosaves."""
-> 1480 self.history_manager = HistoryManager(shell=self, parent=self)
self.history_manager = None
global HistoryManager = <class 'IPython.core.history.HistoryManager'>
global shell = undefined
self = <sage.repl.interpreter.SageInteractiveShell object at
0x108d5ce50>
global parent = undefined
1481 self.configurables.append(self.history_manager)
1482
1483
#-------------------------------------------------------------------------
1484 # Things related to exception handling and tracebacks (not
debugging)
1485
#-------------------------------------------------------------------------
1486
1487 def init_traceback_handlers(self, custom_exceptions):
1488 # Syntax error handler.
1489 self.SyntaxTB = ultratb.SyntaxTB(color_scheme='NoColor')
1490
1491 # The interactive one is initialized with an offset, meaning we
always
1492 # want to remove the topmost item in the traceback, which is
our own
1493 # internal code. Valid modes: ['Plain','Context','Verbose']
1494 self.InteractiveTB = ultratb.AutoFormattedTB(mode = 'Plain',
1495
color_scheme='NoColor',
/Applications/sage/local/lib/python2.7/site-packages/IPython/core/history.pyc
in __init__(self=<IPython.core.history.HistoryManager object>,
shell=<sage.repl.interpreter.SageInteractiveShell object>, config=None,
**traits={'parent': <sage.repl.interpreter.SageInteractiveShell object>})
466 _exit_re = re.compile(r"(exit|quit)(\s*\(.*\))?$")
467
468 def __init__(self, shell=None, config=None, **traits):
469 """Create a new history manager associated with a shell
instance.
470 """
471 # We need a pointer back to the shell for various tasks.
472 super(HistoryManager, self).__init__(shell=shell, config=config,
473 **traits)
474 self.save_flag = threading.Event()
475 self.db_input_cache_lock = threading.Lock()
476 self.db_output_cache_lock = threading.Lock()
477 if self.enabled and self.hist_file != ':memory:':
478 self.save_thread = HistorySavingThread(self)
479 self.save_thread.start()
480
--> 481 self.new_session()
self.new_session = <bound method HistoryManager.new_session of
<IPython.core.history.HistoryManager object at 0x108d5c3d0>>
482
483 def _get_hist_file_name(self, profile=None):
484 """Get default history file name based on the Shell's profile.
485
486 The profile parameter is ignored, but must exist for
compatibility with
487 the parent class."""
488 profile_dir = self.shell.profile_dir.location
489 return os.path.join(profile_dir, 'history.sqlite')
490
491 @needs_sqlite
492 def new_session(self, conn=None):
493 """Get a new session number."""
494 if conn is None:
495 conn = self.db
496
/Applications/sage/local/lib/python2.7/site-packages/IPython/core/history.pyc
in new_session(self=<IPython.core.history.HistoryManager object>, conn=None)
/Applications/sage/local/lib/python2.7/site-packages/IPython/core/history.pyc
in needs_sqlite(f=<function new_session>,
self=<IPython.core.history.HistoryManager object>, *a=(None,), **kw={})
50 pass
51
52 def __enter__(self, *args, **kwargs):
53 pass
54
55 def __exit__(self, *args, **kwargs):
56 pass
57
58
59 @decorator
60 def needs_sqlite(f, self, *a, **kw):
61 """return an empty list in the absence of sqlite"""
62 if sqlite3 is None or not self.enabled:
63 return []
64 else:
---> 65 return f(self, *a, **kw)
f = <function new_session at 0x108c04c80>
self = <IPython.core.history.HistoryManager object at 0x108d5c3d0>
a = (None,)
kw = {}
66
67
68 if sqlite3 is not None:
69 DatabaseError = sqlite3.DatabaseError
70 else:
71 class DatabaseError(Exception):
72 "Dummy exception when sqlite could not be imported. Should
never occur."
73
74 @decorator
75 def catch_corrupt_db(f, self, *a, **kw):
76 """A decorator which wraps HistoryAccessor method calls to catch
errors from
77 a corrupt SQLite database, move the old database out of the way,
and create
78 a new one.
79 """
80 try:
/Applications/sage/local/lib/python2.7/site-packages/IPython/core/history.pyc
in new_session(self=<IPython.core.history.HistoryManager object>,
conn=<sqlite3.Connection object>)
485
486 The profile parameter is ignored, but must exist for
compatibility with
487 the parent class."""
488 profile_dir = self.shell.profile_dir.location
489 return os.path.join(profile_dir, 'history.sqlite')
490
491 @needs_sqlite
492 def new_session(self, conn=None):
493 """Get a new session number."""
494 if conn is None:
495 conn = self.db
496
497 with conn:
498 cur = conn.execute("""INSERT INTO sessions VALUES (NULL, ?,
NULL,
499 NULL, "") """, (datetime.datetime.now(),))
--> 500 self.session_number = cur.lastrowid
self.session_number = 15
cur.lastrowid = 15
501
502 def end_session(self):
503 """Close the database session, filling in the end time and line
count."""
504 self.writeout_cache()
505 with self.db:
506 self.db.execute("""UPDATE sessions SET end=?, num_cmds=?
WHERE
507 session==?""", (datetime.datetime.now(),
508 len(self.input_hist_parsed)-1,
self.session_number))
509 self.session_number = 0
510
511 def name_session(self, name):
512 """Give the current session a name in the history database."""
513 with self.db:
514 self.db.execute("UPDATE sessions SET remark=? WHERE
session==?",
515 (name, self.session_number))
OperationalError: disk I/O error
***************************************************************************
History of session input: