'Run script inside current interpreter or in a new one'

@Slot()
def run_file(self, debug=False):

    editorstack = self.get_current_editorstack()
    if editorstack.save():
        editor = self.get_current_editor()
        fname = osp.abspath(self.get_current_filename())
        fname = fname.replace("'", "\\'")
        fname = fname.replace('"', '\\"')
        runconf = get_run_configuration(fname)
        if (runconf is None):
            dialog = RunConfigOneDialog(self)
            dialog.size_change.connect((lambda s: self.set_dialog_size(s)))
            if (self.dialog_size is not None):
                dialog.resize(self.dialog_size)
            dialog.setup(fname)
            if CONF.get('run', 'open_at_least_once', (not PYTEST)):
                show_dlg = True
                CONF.set('run', 'open_at_least_once', False)
            else:
                show_dlg = CONF.get('run', ALWAYS_OPEN_FIRST_RUN_OPTION)
            if (show_dlg and (not dialog.exec_())):
                return
            runconf = dialog.get_configuration()
        args = runconf.get_arguments()
        python_args = runconf.get_python_arguments()
        interact = runconf.interact
        post_mortem = runconf.post_mortem
        current = runconf.current
        systerm = runconf.systerm
        clear_namespace = runconf.clear_namespace
        if runconf.file_dir:
            wdir = osp.dirname(fname)
        elif runconf.cw_dir:
            wdir = ''
        elif osp.isdir(runconf.dir):
            wdir = runconf.dir
        else:
            wdir = ''
        python = True
        self.__last_ec_exec = (fname, wdir, args, interact, debug, python, python_args, current, systerm, post_mortem, clear_namespace)
        self.re_run_file()
        if ((not interact) and (not debug)):
            editor.setFocus()
