Skip to content

Instantly share code, notes, and snippets.

@takluyver
Created August 1, 2011 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takluyver/1118274 to your computer and use it in GitHub Desktop.
Save takluyver/1118274 to your computer and use it in GitHub Desktop.
IPython Qtconsole crash report
***************************************************************************
IPython post-mortem report
{'commit_hash': '464280a',
'commit_source': 'installation',
'ipython_path': 'c:\\python26\\lib\\site-packages\\IPython',
'ipython_version': '0.11',
'os_name': 'nt',
'platform': 'Windows-XP-5.1.2600-SP2',
'sys_executable': 'C:\\Python26\\python.exe',
'sys_platform': 'win32',
'sys_version': '2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]'}
***************************************************************************
***************************************************************************
Crash traceback:
---------------------------------------------------------------------------
RuntimeError Python 2.6.5: C:\Python26\python.exe
Mon Aug 01 10:13:07 2011
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.
C:\Python26\Scripts\ipython-script.py in <module>()
1 #!python.exe
2 # EASY-INSTALL-ENTRY-SCRIPT: 'ipython==0.11','console_scripts','ipython'
3 __requires__ = 'ipython==0.11'
4 import sys
5 from pkg_resources import load_entry_point
6
7 if __name__ == '__main__':
8 sys.exit(
----> 9 load_entry_point('ipython==0.11', 'console_scripts', 'ipython')()
global load_entry_point = <function load_entry_point at 0x00DBC3B0>
10 )
c:\python26\lib\site-packages\IPython\frontend\terminal\ipapp.pyc in launch_new_instance()
354 if ipython_dir is None:
355 ipython_dir = get_ipython_dir()
356 profile_dir = os.path.join(ipython_dir, 'profile_default')
357 cl = PyFileConfigLoader(default_config_file_name, profile_dir)
358 try:
359 config = cl.load_config()
360 except IOError:
361 # no config found
362 config = Config()
363 return config
364
365
366 def launch_new_instance():
367 """Create and run a full blown IPython instance"""
368 app = TerminalIPythonApp.instance()
--> 369 app.initialize()
370 app.start()
371
372
373 if __name__ == '__main__':
374 launch_new_instance()
c:\python26\lib\site-packages\IPython\frontend\terminal\ipapp.pyc in initialize(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, argv=None)
258 warn.warn("`-pylab` flag has been deprecated.\n"
259 " Use `--pylab` instead, or `--pylab=foo` to specify a backend.")
260 sub = '--pylab'
261 if len(argv) > idx+1:
262 # check for gui arg, as in '-pylab qt'
263 gui = argv[idx+1]
264 if gui in ('wx', 'qt', 'qt4', 'gtk', 'auto'):
265 sub = '--pylab='+gui
266 argv.pop(idx+1)
267 argv[idx] = sub
268
269 return super(TerminalIPythonApp, self).parse_command_line(argv)
270
271 def initialize(self, argv=None):
272 """Do actions after construct, but before starting the app."""
--> 273 super(TerminalIPythonApp, self).initialize(argv)
274 if self.subapp is not None:
275 # don't bother initializing further, starting subapp
276 return
277 if not self.ignore_old_config:
278 check_for_old_config(self.ipython_dir)
279 # print self.extra_args
280 if self.extra_args:
281 self.file_to_run = self.extra_args[0]
282 # create the shell
283 self.init_shell()
284 # and draw the banner
285 self.init_banner()
286 # Now a variety of things that happen after the banner is printed.
287 self.init_gui_pylab()
288 self.init_extensions()
c:\python26\lib\site-packages\IPython\core\application.pyc in initialize(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, argv=None)
283 )
284
285
286 def stage_default_config_file(self):
287 """auto generate default config file, and stage it into the profile."""
288 s = self.generate_config_file()
289 fname = os.path.join(self.profile_dir.location, self.config_file_name)
290 if self.overwrite or not os.path.exists(fname):
291 self.log.warn("Generating default config file: %r"%(fname))
292 with open(fname, 'w') as f:
293 f.write(s)
294
295
296 def initialize(self, argv=None):
297 # don't hook up crash handler before parsing command-line
--> 298 self.parse_command_line(argv)
299 self.init_crash_handler()
300 if self.subapp is not None:
301 # stop here if subapp is taking over
302 return
303 cl_config = self.config
304 self.init_profile_dir()
305 self.init_config_files()
306 self.load_config_file()
307 # enforce cl-opts override configfile opts:
308 self.update_config(cl_config)
309
c:\python26\lib\site-packages\IPython\frontend\terminal\ipapp.pyc in parse_command_line(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, argv=['qtconsole'])
254 # deprecated `-pylab` given,
255 # warn and transform into current syntax
256 argv = argv[:] # copy, don't clobber
257 idx = argv.index('-pylab')
258 warn.warn("`-pylab` flag has been deprecated.\n"
259 " Use `--pylab` instead, or `--pylab=foo` to specify a backend.")
260 sub = '--pylab'
261 if len(argv) > idx+1:
262 # check for gui arg, as in '-pylab qt'
263 gui = argv[idx+1]
264 if gui in ('wx', 'qt', 'qt4', 'gtk', 'auto'):
265 sub = '--pylab='+gui
266 argv.pop(idx+1)
267 argv[idx] = sub
268
--> 269 return super(TerminalIPythonApp, self).parse_command_line(argv)
270
271 def initialize(self, argv=None):
272 """Do actions after construct, but before starting the app."""
273 super(TerminalIPythonApp, self).initialize(argv)
274 if self.subapp is not None:
275 # don't bother initializing further, starting subapp
276 return
277 if not self.ignore_old_config:
278 check_for_old_config(self.ipython_dir)
279 # print self.extra_args
280 if self.extra_args:
281 self.file_to_run = self.extra_args[0]
282 # create the shell
283 self.init_shell()
284 # and draw the banner
c:\python26\lib\site-packages\IPython\config\application.pyc in parse_command_line(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, argv=['qtconsole'])
325 self.__class__.clear_instance()
326 # instantiate
327 self.subapp = subapp.instance()
328 # and initialize subapp
329 self.subapp.initialize(argv)
330
331 def parse_command_line(self, argv=None):
332 """Parse the command line arguments."""
333 argv = sys.argv[1:] if argv is None else argv
334
335 if self.subcommands and len(argv) > 0:
336 # we have subcommands, and one may have been specified
337 subc, subargv = argv[0], argv[1:]
338 if re.match(r'^\w(\-?\w)*$', subc) and subc in self.subcommands:
339 # it's a subcommand, and *not* a flag or class parameter
--> 340 return self.initialize_subcommand(subc, subargv)
341
342 if '-h' in argv or '--help' in argv or '--help-all' in argv:
343 self.print_description()
344 self.print_help('--help-all' in argv)
345 self.print_examples()
346 self.exit(0)
347
348 if '--version' in argv:
349 self.print_version()
350 self.exit(0)
351
352 loader = KeyValueConfigLoader(argv=argv, aliases=self.aliases,
353 flags=self.flags)
354 try:
355 config = loader.load_config()
c:\python26\lib\site-packages\IPython\config\application.pyc in initialize_subcommand(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, subc='qtconsole', argv=[])
314 # events.
315 self.config = newconfig
316
317 def initialize_subcommand(self, subc, argv=None):
318 """Initialize a subcommand with argv."""
319 subapp,help = self.subcommands.get(subc)
320
321 if isinstance(subapp, basestring):
322 subapp = import_item(subapp)
323
324 # clear existing instances
325 self.__class__.clear_instance()
326 # instantiate
327 self.subapp = subapp.instance()
328 # and initialize subapp
--> 329 self.subapp.initialize(argv)
330
331 def parse_command_line(self, argv=None):
332 """Parse the command line arguments."""
333 argv = sys.argv[1:] if argv is None else argv
334
335 if self.subcommands and len(argv) > 0:
336 # we have subcommands, and one may have been specified
337 subc, subargv = argv[0], argv[1:]
338 if re.match(r'^\w(\-?\w)*$', subc) and subc in self.subcommands:
339 # it's a subcommand, and *not* a flag or class parameter
340 return self.initialize_subcommand(subc, subargv)
341
342 if '-h' in argv or '--help' in argv or '--help-all' in argv:
343 self.print_description()
344 self.print_help('--help-all' in argv)
c:\python26\lib\site-packages\IPython\frontend\qt\console\qtconsoleapp.pyc in initialize(self=<IPython.frontend.qt.console.qtconsoleapp.IPythonQtConsoleApp object>, argv=[])
409 widget.set_default_style()
410
411 if self.stylesheet:
412 # we got an expicit stylesheet
413 if os.path.isfile(self.stylesheet):
414 with open(self.stylesheet) as f:
415 sheet = f.read()
416 widget.style_sheet = sheet
417 widget._style_sheet_changed()
418 else:
419 raise IOError("Stylesheet %r not found."%self.stylesheet)
420
421 def initialize(self, argv=None):
422 super(IPythonQtConsoleApp, self).initialize(argv)
423 self.init_kernel_manager()
--> 424 self.init_qt_elements()
425 self.init_colors()
426
427 def start(self):
428
429 # draw the window
430 self.window.show()
431
432 # Start the application main loop.
433 self.app.exec_()
434
435 #-----------------------------------------------------------------------------
436 # Main entry point
437 #-----------------------------------------------------------------------------
438
439 def main():
c:\python26\lib\site-packages\IPython\frontend\qt\console\qtconsoleapp.pyc in init_qt_elements(self=<IPython.frontend.qt.console.qtconsoleapp.IPythonQtConsoleApp object>)
336 config=self.config
337 )
338 # start the kernel
339 if not self.existing:
340 kwargs = dict(ip=self.ip, ipython=not self.pure)
341 kwargs['extra_arguments'] = self.kernel_argv
342 self.kernel_manager.start_kernel(**kwargs)
343 self.kernel_manager.start_channels()
344
345
346 def init_qt_elements(self):
347 # Create the widget.
348 self.app = QtGui.QApplication([])
349 local_kernel = (not self.existing) or self.ip in LOCAL_IPS
350 self.widget = self.widget_factory(config=self.config,
--> 351 local_kernel=local_kernel)
352 self.widget.kernel_manager = self.kernel_manager
353 self.window = MainWindow(self.app, self.widget, self.existing,
354 may_close=local_kernel,
355 confirm_exit=self.confirm_exit)
356 self.window.setWindowTitle('Python' if self.pure else 'IPython')
357
358 def init_colors(self):
359 """Configure the coloring of the widget"""
360 # Note: This will be dramatically simplified when colors
361 # are removed from the backend.
362
363 if self.pure:
364 # only IPythonWidget supports styling
365 return
366
c:\python26\lib\site-packages\IPython\frontend\qt\console\rich_ipython_widget.pyc in __init__(self=<IPython.frontend.qt.console.rich_ipython_widget.RichIPythonWidget object>, *args=(), **kw={'config': {'ProfileDir': {}}, 'kind': 'rich', 'local_kernel': True})
16 tables. Note that raw performance will be reduced compared to the plain
17 text version.
18 """
19
20 # RichIPythonWidget protected class variables.
21 _payload_source_plot = 'IPython.zmq.pylab.backend_payload.add_plot_payload'
22
23 #---------------------------------------------------------------------------
24 # 'object' interface
25 #---------------------------------------------------------------------------
26
27 def __init__(self, *args, **kw):
28 """ Create a RichIPythonWidget.
29 """
30 kw['kind'] = 'rich'
---> 31 super(RichIPythonWidget, self).__init__(*args, **kw)
global t = undefined
global contentt = undefined
global execution_countt = undefined
global datas = undefined
32
33 # Configure the ConsoleWidget HTML exporter for our formats.
34 self._html_exporter.image_tag = self._get_image_tag
35
36 # Dictionary for resolving document resource names to SVG data.
37 self._name_to_svg_map = {}
38
39 #---------------------------------------------------------------------------
40 # 'ConsoleWidget' protected interface
41 #---------------------------------------------------------------------------
42
43 def _context_menu_make(self, pos):
44 """ Reimplemented to return a custom context menu for images.
45 """
46 format = self._control.cursorForPosition(pos).charFormat()
c:\python26\lib\site-packages\IPython\frontend\qt\console\ipython_widget.pyc in __init__(self=<IPython.frontend.qt.console.rich_ipython_widget.RichIPythonWidget object>, *args=(), **kw={'config': {'ProfileDir': {}}, 'kind': 'rich', 'local_kernel': True})
99 # FrontendWidget protected class variables.
100 _input_splitter_class = IPythonInputSplitter
101
102 # IPythonWidget protected class variables.
103 _PromptBlock = namedtuple('_PromptBlock', ['block', 'length', 'number'])
104 _payload_source_edit = zmq_shell_source + '.edit_magic'
105 _payload_source_exit = zmq_shell_source + '.ask_exit'
106 _payload_source_next_input = zmq_shell_source + '.set_next_input'
107 _payload_source_page = 'IPython.zmq.page.page'
108
109 #---------------------------------------------------------------------------
110 # 'object' interface
111 #---------------------------------------------------------------------------
112
113 def __init__(self, *args, **kw):
--> 114 super(IPythonWidget, self).__init__(*args, **kw)
global KeepAnchorR = undefined
global R = undefined
global t = undefined
global _insert_html_fetching_plain_textR = undefined
global _highlightert = undefined
global rehighlightBlockR = undefined
global RO = undefined
global RQ = undefined
global previous_prompt_numberR = undefined
global RA = undefined
global RL = undefined
global sK = undefined
global C = undefined
global Python26 = undefined
global Lib = undefined
global site = undefined
global packages = undefined
global IPython = undefined
global frontend = undefined
global qt = undefined
global console = undefined
global ipython_widget.pyt = undefined
global _show_interpreter_prompt_for_replyT = undefined
global s = undefined
global lightbgc = undefined
global i = undefined
global d = undefined
global j = undefined
global o = undefined
global _ = undefined
global nc = undefined
global n = undefined
global S = undefined
global Sets = undefined
global the = undefined
global widget = undefined
global style = undefined
global to = undefined
global defaults.Parameters = undefined
global colors = undefined
global str = undefined
global optional = undefined
global default = undefined
global lightbg = undefined
global Whether = undefined
global use = undefined
global light = undefined
global background = undefined
global dark = undefined
global B = undefined
global W = undefined
global style.R = undefined
global linuxt = undefined
global nocolors = undefined
global No = undefined
global such = undefined
global color = undefined
global scheme = undefined
global sN = undefined
global lowert = undefined
global stylest = undefined
global default_light_style_sheetR = undefined
global c = undefined
global s.i = undefined
global p = undefined
global y = undefined
global nM = undefined
global Wn = undefined
global X = undefined
115
116 # IPythonWidget protected variables.
117 self._payload_handlers = {
118 self._payload_source_edit : self._handle_payload_edit,
119 self._payload_source_exit : self._handle_payload_exit,
120 self._payload_source_page : self._handle_payload_page,
121 self._payload_source_next_input : self._handle_payload_next_input }
122 self._previous_prompt_obj = None
123 self._keep_kernel_on_exit = None
124
125 # Initialize widget styling.
126 if self.style_sheet:
127 self._style_sheet_changed()
128 self._syntax_style_changed()
129 else:
c:\python26\lib\site-packages\IPython\frontend\qt\console\frontend_widget.pyc in __init__(self=<IPython.frontend.qt.console.rich_ipython_widget.RichIPythonWidget object>, *args=(), **kw={'config': {'ProfileDir': {}}, 'kind': 'rich', 'local_kernel': True})
98 exit_requested = QtCore.Signal()
99
100 # Protected class variables.
101 _CallTipRequest = namedtuple('_CallTipRequest', ['id', 'pos'])
102 _CompletionRequest = namedtuple('_CompletionRequest', ['id', 'pos'])
103 _ExecutionRequest = namedtuple('_ExecutionRequest', ['id', 'kind'])
104 _input_splitter_class = InputSplitter
105 _local_kernel = False
106 _highlighter = Instance(FrontendHighlighter)
107
108 #---------------------------------------------------------------------------
109 # 'object' interface
110 #---------------------------------------------------------------------------
111
112 def __init__(self, *args, **kw):
--> 113 super(FrontendWidget, self).__init__(*args, **kw)
global expandtabsR = undefined
global R = undefined
global t = undefined
114
115 # FrontendWidget protected variables.
116 self._bracket_matcher = BracketMatcher(self._control)
117 self._call_tip_widget = CallTipWidget(self._control)
118 self._completion_lexer = CompletionLexer(PythonLexer())
119 self._copy_raw_action = QtGui.QAction('Copy (Raw Text)', None)
120 self._hidden = False
121 self._highlighter = FrontendHighlighter(self)
122 self._input_splitter = self._input_splitter_class(input_mode='cell')
123 self._kernel_manager = None
124 self._request_info = {}
125
126 # Configure the ConsoleWidget.
127 self.tab_width = 4
128 self._set_continuation_prompt('... ')
c:\python26\lib\site-packages\IPython\frontend\qt\console\history_console_widget.pyc in __init__(self=<IPython.frontend.qt.console.rich_ipython_widget.RichIPythonWidget object>, *args=(), **kw={'config': {'ProfileDir': {}}, 'kind': 'rich', 'local_kernel': True})
11 executed and provides a readline-esque interface to this history.
12 """
13
14 #------ Configuration ------------------------------------------------------
15
16 # If enabled, the input buffer will become "locked" to history movement when
17 # an edit is made to a multi-line input buffer. To override the lock, use
18 # Shift in conjunction with the standard history cycling keys.
19 history_lock = Bool(False, config=True)
20
21 #---------------------------------------------------------------------------
22 # 'object' interface
23 #---------------------------------------------------------------------------
24
25 def __init__(self, *args, **kw):
---> 26 super(HistoryConsoleWidget, self).__init__(*args, **kw)
global R = undefined
global t = undefined
global history_previoust = undefined
global movePositionR = undefined
global QTextCursort = undefined
global Rightt = undefined
global EndOfLinet = undefined
global _set_cursort = undefined
global True = undefined
global shift_modifiert = undefined
global prompt_cursort = undefined
global colR = undefined
global cursor = undefined
global sS = undefined
global C = undefined
global Python26 = undefined
global Lib = undefined
global site = undefined
global packages = undefined
global IPython = undefined
global frontend = undefined
global qt = undefined
global console = undefined
global history_console_widget.pyt = undefined
global _up_pressedB = undefined
global s = undefined
global c = undefined
global i = undefined
global j = undefined
global o = undefined
global S = undefined
global oF = undefined
27
28 # HistoryConsoleWidget protected variables.
29 self._history = []
30 self._history_edits = {}
31 self._history_index = 0
32 self._history_prefix = ''
33
34 #---------------------------------------------------------------------------
35 # 'ConsoleWidget' public interface
36 #---------------------------------------------------------------------------
37
38 def execute(self, source=None, hidden=False, interactive=False):
39 """ Reimplemented to the store history.
40 """
41 if not hidden:
c:\python26\lib\site-packages\IPython\frontend\qt\console\console_widget.pyc in __init__(self=<IPython.frontend.qt.console.rich_ipython_widget.RichIPythonWidget object>, parent=None, **kw={'config': {'ProfileDir': {}}, 'kind': 'rich', 'local_kernel': True})
156 [ QtCore.Qt.Key_C, QtCore.Qt.Key_G, QtCore.Qt.Key_O,
157 QtCore.Qt.Key_V ])
158
159 #---------------------------------------------------------------------------
160 # 'QObject' interface
161 #---------------------------------------------------------------------------
162
163 def __init__(self, parent=None, **kw):
164 """ Create a ConsoleWidget.
165
166 Parameters:
167 -----------
168 parent : QWidget, optional [default None]
169 The parent for this widget.
170 """
--> 171 QtGui.QWidget.__init__(self, parent)
global The = undefined
global source = undefined
global to = undefined
global execute.If = undefined
global specified = undefined
global the = undefined
global input = undefined
global buffer = undefined
global will = undefined
global be = undefined
172 Configurable.__init__(self, **kw)
173
174 # Create the layout and underlying text widget.
175 layout = QtGui.QStackedLayout(self)
176 layout.setContentsMargins(0, 0, 0, 0)
177 self._control = self._create_control()
178 self._page_control = None
179 self._splitter = None
180 if self.paging in ('hsplit', 'vsplit'):
181 self._splitter = QtGui.QSplitter()
182 if self.paging == 'hsplit':
183 self._splitter.setOrientation(QtCore.Qt.Horizontal)
184 else:
185 self._splitter.setOrientation(QtCore.Qt.Vertical)
186 self._splitter.addWidget(self._control)
RuntimeError: You can't initialize an object twice!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment