How do I embed an IPython Interpreter into an application running in an IPython Qt Console
Question: There are a few topics on this, but none with a satisfactory answer.

I have a python application running in an IPython qt console

<http://ipython.org/ipython-doc/dev/interactive/qtconsole.html>

When I encounter an error, I'd like to be able to interact with the code at
that point.

    
    
        try: 
          raise Exception()
        except Exception as e:
            try: # use exception trick to pick up the current frame
                raise None
            except:
                frame = sys.exc_info()[2].tb_frame.f_back
            namespace = frame.f_globals.copy()
            namespace.update(frame.f_locals)
            import IPython
            IPython.embed_kernel(local_ns=namespace)  
    

I would think this would work, but I get an error:

RuntimeError: threads can only be started once


Answer: I just use this:

    
    
    from IPython import embed; embed()
    

works better than anything else for me :)

