def run_external_cmdline(w, size, key):
    self.screen.stop()
    curframe = self.debugger.curframe
    import pudb.shell as shell
    if ((CONFIG['shell'] == 'ipython') and shell.have_ipython()):
        runner = shell.run_ipython_shell
    elif ((CONFIG['shell'] == 'ipython_kernel') and shell.have_ipython()):
        runner = shell.run_ipython_kernel
    elif ((CONFIG['shell'] == 'bpython') and shell.HAVE_BPYTHON):
        runner = shell.run_bpython_shell
    elif ((CONFIG['shell'] == 'ptpython') and shell.HAVE_PTPYTHON):
        runner = shell.run_ptpython_shell
    elif ((CONFIG['shell'] == 'ptipython') and shell.HAVE_PTIPYTHON):
        runner = shell.run_ptipython_shell
    elif (CONFIG['shell'] == 'classic'):
        runner = shell.run_classic_shell
    else:
        try:
            if (not shell.custom_shell_dict):
                from os.path import expanduser
                cshell_fname = expanduser(CONFIG['shell'])
                with open(cshell_fname) as inf:
                    exec(compile(inf.read(), cshell_fname, 'exec'), shell.custom_shell_dict, shell.custom_shell_dict)
        except Exception:
            print('Error when importing custom shell:')
            from traceback import print_exc
            print_exc()
            print('Falling back to classic shell')
            runner = shell.run_classic_shell
        else:
            if ('pudb_shell' not in shell.custom_shell_dict):
                print(('%s does not contain a function named pudb_shell at the module level.' % CONFIG['shell']))
                print('Falling back to classic shell')
                runner = shell.run_classic_shell
            else:
                runner = shell.custom_shell_dict['pudb_shell']
    runner(curframe.f_globals, curframe.f_locals)
    self.screen.start()
    self.update_var_view()
def run_external_cmdline(w, size, key):
    self.screen.stop()
    curframe = self.debugger.curframe
    import pudb.shell as shell
    if ((CONFIG['shell'] == 'ipython') and shell.have_ipython()):
        runner = shell.run_ipython_shell
    elif ((CONFIG['shell'] == 'ipython_kernel') and shell.have_ipython()):
        runner = shell.run_ipython_kernel
    elif ((CONFIG['shell'] == 'bpython') and shell.HAVE_BPYTHON):
        runner = shell.run_bpython_shell
    elif ((CONFIG['shell'] == 'ptpython') and shell.HAVE_PTPYTHON):
        runner = shell.run_ptpython_shell
    elif ((CONFIG['shell'] == 'ptipython') and shell.HAVE_PTIPYTHON):
        runner = shell.run_ptipython_shell
    elif (CONFIG['shell'] == 'classic'):
        runner = shell.run_classic_shell
    else:
        try:
            if (not shell.custom_shell_dict):
                from os.path import expanduser
                cshell_fname = expanduser(CONFIG['shell'])
                with open(cshell_fname) as inf:
                    exec(compile(inf.read(), cshell_fname, 'exec'), shell.custom_shell_dict, shell.custom_shell_dict)
        except Exception:
            print('Error when importing custom shell:')
            from traceback import print_exc
            print_exc()
            print('Falling back to classic shell')
            runner = shell.run_classic_shell
        else:
            if ('pudb_shell' not in shell.custom_shell_dict):
                print(('%s does not contain a function named pudb_shell at the module level.' % CONFIG['shell']))
                print('Falling back to classic shell')
                runner = shell.run_classic_shell
            else:
                runner = shell.custom_shell_dict['pudb_shell']
    runner(curframe.f_globals, curframe.f_locals)
    self.screen.start()
    self.update_var_view()