[IPython-dev] Helping battle testing the newapp branch

Tom Dimiduk tdimiduk at physics.harvard.edu
Thu Jun 16 10:57:24 EDT 2011


The new qtconsole crashes on ubuntu 11.04 (see below).  This crash 
clears right up when I upgrade to pyqmq version 2.1.7, but the app 
thinks it can run with pyzmq 2.0.10-1 and I got this crash with ubuntu 
packaged 2.0.10.1-1 so I thought you might like to know.

-----

[tdimiduk at kBt:~|284]$ ipython qtconsole
Starting the kernel at pid: 14841
---------------------------------------------------------------------------
AttributeError                               Python 2.7.1+: /usr/bin/python
                                                    Thu Jun 16 10:22:19 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.
/usr/local/bin/ipython in <module>()
       1 #!/usr/bin/python
       2 """Terminal-based IPython entry point.
       3
       4 Note: this is identical to 
IPython/frontend/terminal/scripts/ipython for now.
       5 Once 0.11 is closer to release, we will likely need to 
reorganize the script
       6 entry points."""
       7
       8 from IPython.frontend.terminal.ipapp import launch_new_instance
       9
---> 10 launch_new_instance()
         global launch_new_instance = <function launch_new_instance at 
0x26c38c0>

/usr/local/lib/python2.7/dist-packages/IPython/frontend/terminal/ipapp.pyc 
in launch_new_instance()
     336     """Load the default config file from the default ipython_dir.
     337
     338     This is useful for embedded shells.
     339     """
     340     if ipython_dir is None:
     341         ipython_dir = get_ipython_dir()
     342     profile_dir = os.path.join(ipython_dir, 'profile_default')
     343     cl = PyFileConfigLoader(default_config_file_name, profile_dir)
     344     config = cl.load_config()
     345     return config
     346
     347
     348 def launch_new_instance():
     349     """Create and run a full blown IPython instance"""
     350     app = TerminalIPythonApp.instance()
--> 351     app.initialize()
     352     app.start()
     353
     354
     355 if __name__ == '__main__':
     356     launch_new_instance()
     357

/usr/local/lib/python2.7/dist-packages/IPython/frontend/terminal/ipapp.pyc 
in initialize(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp 
object>, argv=None)
     244     def _force_interact_changed(self, name, old, new):
     245         if new:
     246             self.interact = True
     247
     248     def _file_to_run_changed(self, name, old, new):
     249         if new and not self.force_interact:
     250                 self.interact = False
     251     _code_to_run_changed = _file_to_run_changed
     252
     253     # internal, not-configurable
     254     interact=Bool(True)
     255
     256
     257     def initialize(self, argv=None):
     258         """Do actions after construct, but before starting the 
app."""
--> 259         super(TerminalIPythonApp, self).initialize(argv)
     260         if self.subapp is not None:
     261             # don't bother initializing further, starting subapp
     262             return
     263         if not self.ignore_old_config:
     264             check_for_old_config(self.ipython_dir)
     265         # print self.extra_args
     266         if self.extra_args:
     267             self.file_to_run = self.extra_args[0]
     268         # create the shell
     269         self.init_shell()
     270         # and draw the banner
     271         self.init_banner()
     272         # Now a variety of things that happen after the banner 
is printed.
     273         self.init_gui_pylab()
     274         self.init_extensions()

/usr/local/lib/python2.7/dist-packages/IPython/core/application.pyc in 
initialize(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp 
object>, argv=None)
     265             else:
     266                 self.stage_default_config_file()
     267
     268     def stage_default_config_file(self):
     269         """auto generate default config file, and stage it into 
the profile."""
     270         s = self.generate_config_file()
     271         fname = os.path.join(self.profile_dir.location, 
self.config_file_name)
     272         if self.overwrite or not os.path.exists(fname):
     273             self.log.warn("Generating default config file: 
%r"%(fname))
     274             with open(fname, 'w') as f:
     275                 f.write(s)
     276
     277
     278     def initialize(self, argv=None):
     279         self.init_crash_handler()
--> 280         self.parse_command_line(argv)
     281         if self.subapp is not None:
     282             # stop here if subapp is taking over
     283             return
     284         cl_config = self.config
     285         self.init_profile_dir()
     286         self.init_config_files()
     287         self.load_config_file()
     288         # enforce cl-opts override configfile opts:
     289         self.update_config(cl_config)
     290

/usr/local/lib/python2.7/dist-packages/IPython/config/application.pyc in 
parse_command_line(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp 
object>, argv=['qtconsole'])
     300         self.__class__.clear_instance()
     301         # instantiate
     302         self.subapp = subapp.instance()
     303         # and initialize subapp
     304         self.subapp.initialize(argv)
     305
     306     def parse_command_line(self, argv=None):
     307         """Parse the command line arguments."""
     308         argv = sys.argv[1:] if argv is None else argv
     309
     310         if self.subcommands and len(argv) > 0:
     311             # we have subcommands, and one may have been specified
     312             subc, subargv = argv[0], argv[1:]
     313             if re.match(r'^\w(\-?\w)*$', subc) and subc in 
self.subcommands:
     314                 # it's a subcommand, and *not* a flag or class 
parameter
--> 315                 return self.initialize_subcommand(subc, subargv)
     316
     317         if '-h' in argv or '--help' in argv or '--help-all' in 
argv:
     318             self.print_description()
     319             self.print_help('--help-all' in argv)
     320             self.exit(0)
     321
     322         if '--version' in argv:
     323             self.print_version()
     324             self.exit(0)
     325
     326         loader = KeyValueConfigLoader(argv=argv, 
aliases=self.aliases,
     327                                         flags=self.flags)
     328         try:
     329             config = loader.load_config()
     330         except ArgumentError as e:

/usr/local/lib/python2.7/dist-packages/IPython/config/application.pyc in 
initialize_subcommand(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp 
object>, subc='qtconsole', argv=[])
     289         # events.
     290         self.config = newconfig
     291
     292     def initialize_subcommand(self, subc, argv=None):
     293         """Initialize a subcommand with argv."""
     294         subapp,help = self.subcommands.get(subc)
     295
     296         if isinstance(subapp, basestring):
     297             subapp = import_item(subapp)
     298
     299         # clear existing instances
     300         self.__class__.clear_instance()
     301         # instantiate
     302         self.subapp = subapp.instance()
     303         # and initialize subapp
--> 304         self.subapp.initialize(argv)
     305
     306     def parse_command_line(self, argv=None):
     307         """Parse the command line arguments."""
     308         argv = sys.argv[1:] if argv is None else argv
     309
     310         if self.subcommands and len(argv) > 0:
     311             # we have subcommands, and one may have been specified
     312             subc, subargv = argv[0], argv[1:]
     313             if re.match(r'^\w(\-?\w)*$', subc) and subc in 
self.subcommands:
     314                 # it's a subcommand, and *not* a flag or class 
parameter
     315                 return self.initialize_subcommand(subc, subargv)
     316
     317         if '-h' in argv or '--help' in argv or '--help-all' in 
argv:
     318             self.print_description()
     319             self.print_help('--help-all' in argv)

/usr/local/lib/python2.7/dist-packages/IPython/frontend/qt/console/qtconsoleapp.pyc 
in 
initialize(self=<IPython.frontend.qt.console.qtconsoleapp.IPythonQtConsoleApp 
object>, argv=[])
     383             # defaults to change
     384             widget.set_default_style()
     385
     386         if self.stylesheet:
     387             # we got an expicit stylesheet
     388             if os.path.isfile(self.stylesheet):
     389                 with open(self.stylesheet) as f:
     390                     sheet = f.read()
     391                 widget.style_sheet = sheet
     392                 widget._style_sheet_changed()
     393             else:
     394                 raise IOError("Stylesheet %r not 
found."%self.stylesheet)
     395
     396     def initialize(self, argv=None):
     397         super(IPythonQtConsoleApp, self).initialize(argv)
--> 398         self.init_kernel_manager()
     399         self.init_qt_elements()
     400         self.init_colors()
     401
     402     def start(self):
     403
     404         # draw the window
     405         self.window.show()
     406
     407         # Start the application main loop.
     408         self.app.exec_()
     409
     410 
#-----------------------------------------------------------------------------
     411 # Main entry point
     412 
#-----------------------------------------------------------------------------
     413

/usr/local/lib/python2.7/dist-packages/IPython/frontend/qt/console/qtconsoleapp.pyc 
in 
init_kernel_manager(self=<IPython.frontend.qt.console.qtconsoleapp.IPythonQtConsoleApp 
object>)
     303         signal.signal(signal.SIGINT, signal.SIG_DFL)
     304
     305         # Create a KernelManager and start a kernel.
     306         self.kernel_manager = QtKernelManager(
     307                                 shell_address=(self.ip, 
self.shell_port),
     308                                 sub_address=(self.ip, 
self.iopub_port),
     309                                 stdin_address=(self.ip, 
self.stdin_port),
     310                                 hb_address=(self.ip, self.hb_port),
     311                                 config=self.config
     312         )
     313         # start the kernel
     314         if not self.existing:
     315             kwargs = dict(ip=self.ip, ipython=not self.pure)
     316             kwargs['extra_arguments'] = self.kernel_argv
     317             self.kernel_manager.start_kernel(**kwargs)
--> 318         self.kernel_manager.start_channels()
     319
     320
     321     def init_qt_elements(self):
     322         # Create the widget.
     323         self.app = QtGui.QApplication([])
     324         local_kernel = (not self.existing) or self.ip in LOCAL_IPS
     325         self.widget = self.widget_factory(config=self.config,
     326                                         local_kernel=local_kernel)
     327         self.widget.kernel_manager = self.kernel_manager
     328         self.window = MainWindow(self.app, self.widget, 
self.existing,
     329                                 may_close=local_kernel,
     330                                 confirm_exit=self.confirm_exit)
     331         self.window.setWindowTitle('Python' if self.pure else 
'IPython')
     332
     333     def init_colors(self):

/usr/local/lib/python2.7/dist-packages/IPython/frontend/qt/kernelmanager.pyc 
in 
start_channels(self=<IPython.frontend.qt.kernelmanager.QtKernelManager 
object>, *args=(), **kw={})
     200
     201     #------ Kernel process management 
------------------------------------------
     202
     203     def start_kernel(self, *args, **kw):
     204         """ Reimplemented for proper heartbeat management.
     205         """
     206         if self._shell_channel is not None:
     207             self._shell_channel.reset_first_reply()
     208         super(QtKernelManager, self).start_kernel(*args, **kw)
     209
     210     #------ Channel management 
-------------------------------------------------
     211
     212     def start_channels(self, *args, **kw):
     213         """ Reimplemented to emit signal.
     214         """
--> 215         super(QtKernelManager, self).start_channels(*args, **kw)
     216         self.started_channels.emit()
     217
     218     def stop_channels(self):
     219         """ Reimplemented to emit signal.
     220         """
     221         super(QtKernelManager, self).stop_channels()
     222         self.stopped_channels.emit()
     223
     224     @property
     225     def shell_channel(self):
     226         """ Reimplemented for proper heartbeat management.
     227         """
     228         if self._shell_channel is None:
     229             self._shell_channel = super(QtKernelManager, 
self).shell_channel
     230 
self._shell_channel.first_reply.connect(self._first_reply)

/usr/local/lib/python2.7/dist-packages/IPython/zmq/kernelmanager.pyc in 
start_channels(self=<IPython.frontend.qt.kernelmanager.QtKernelManager 
object>, shell=True, sub=True, stdin=True, hb=True)
     718         # atexit.register(self.context.term)
     719
     720 
#--------------------------------------------------------------------------
     721     # Channel management methods:
     722 
#--------------------------------------------------------------------------
     723
     724     def start_channels(self, shell=True, sub=True, stdin=True, 
hb=True):
     725         """Starts the channels for this kernel.
     726
     727         This will create the channels if they do not exist and 
then start
     728         them. If port numbers of 0 are being used (random 
ports) then you
     729         must first call :method:`start_kernel`. If the channels 
have been
     730         stopped and you call this, :class:`RuntimeError` will 
be raised.
     731         """
     732         if shell:
--> 733             self.shell_channel.start()
     734         if sub:
     735             self.sub_channel.start()
     736         if stdin:
     737             self.stdin_channel.start()
     738         if hb:
     739             self.hb_channel.start()
     740
     741     def stop_channels(self):
     742         """Stops all the running channels for this kernel.
     743         """
     744         if self.shell_channel.is_alive():
     745             self.shell_channel.stop()
     746         if self.sub_channel.is_alive():
     747             self.sub_channel.stop()
     748         if self.stdin_channel.is_alive():

AttributeError: 'QtKernelManager' object has no attribute 'shell_channel'

**********************************************************************
Oops, ipython-qtconsole crashed. We do our best to make it stable, but...

A crash report was automatically generated with the following information:
   - A verbatim copy of the crash traceback.
   - A copy of your input history during this session.
   - Data on your current ipython-qtconsole configuration.

It was left in the file named:
	'/home/tdimiduk/.config/ipython/Crash_report_ipython-qtconsole.txt'
If you can email this file to the developers, the information in it will 
help
them in understanding and correcting the problem.

You can mail it to: None at None
with the subject 'ipython-qtconsole Crash Report'.

If you want to do it now, the following command will work (under Unix):
mail -s 'ipython-qtconsole Crash Report' None < 
/home/tdimiduk/.config/ipython/Crash_report_ipython-qtconsole.txt

To ensure accurate tracking of this issue, please file a report about it at:
None

Hit <Enter> to quit this message (your terminal may 
close):---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/tdimiduk/<string> in <module>()

/usr/local/lib/python2.7/dist-packages/IPython/zmq/ipkernel.pyc in main()
     666     """Run an IPKernel as an application"""
     667     app = IPKernelApp.instance()
--> 668     app.initialize()
     669     app.start()
     670

/usr/local/lib/python2.7/dist-packages/IPython/zmq/ipkernel.pyc in 
initialize(self=<IPython.zmq.ipkernel.IPKernelApp object>, argv=None)
     600     )
     601     def initialize(self, argv=None):
--> 602         super(IPKernelApp, self).initialize(argv)
     603         self.init_shell()
     604         self.init_extensions()

/usr/local/lib/python2.7/dist-packages/IPython/zmq/kernelapp.pyc in 
initialize(self=<IPython.zmq.ipkernel.IPKernelApp object>, argv=None)
     201         self.init_session()
     202         self.init_poller()
--> 203         self.init_sockets()
     204         self.init_io()
     205         self.init_kernel()

/usr/local/lib/python2.7/dist-packages/IPython/zmq/kernelapp.pyc in 
init_sockets(self=<IPython.zmq.ipkernel.IPKernelApp object>)
     132         # Create a context, a session, and the kernel sockets.
     133         io.raw_print("Starting the kernel at pid:", os.getpid())
--> 134         context = zmq.Context.instance()
     135         # Uncomment this to try closing the context.
     136         # atexit.register(context.term)

AttributeError: type object 'zmq.core.context.Context' has no attribute 
'instance'

On 06/15/2011 06:35 PM, Brian Granger wrote:
> Hi,
>
> Min has done an absolutely fantastic job in finishing the config
> refactor.  The result is in this branch:
>
> https://github.com/ipython/ipython/tree/newapp
>
> The changes are massive and affect all of the top level applications.
> A pretty solid code review has been done, but before we merge this, it
> would be fantastic if we could have other people help try it out.
> Somethings to look at:
>
> * The top level applications:
>
> ipython -h
> ipcluster -h
>
> * Subcommands:
>
> ipython profile
> ipython qtconsole
> ipcluster start
>
> * Command line options and flags (see the help strings).
> * Creation and selection of profiles.
> * Editing config files
>
> Any help would be greatly appreciated!  And thanks to Min for doing
> such a great job.
>
> Cheers,
>
> Brian
>



More information about the IPython-dev mailing list