Ejemplo n.º 1
0
 def runCode_(self, code):
     Python.shared.handleCrashesForCurrentThread()
     try:
         exec(str(code))
     except:
         error = traceback.format_exc()
         PyOutputHelper.printError(error, script=None)
         Python.shared.codeToRun = None
Ejemplo n.º 2
0
    script_path = None
    """
    The script that the thread is running.
    """


while True:

    try:
        code = str(Python.shared.codeToRun)
        exec(code)
        if code == Python.shared.codeToRun:
            Python.shared.codeToRun = None
    except:
        error = traceback.format_exc()
        PyOutputHelper.printError(error, script=None)
        Python.shared.codeToRun = None

    if Python.shared.scriptToRun != None:

        script = Python.shared.scriptToRun

        thread = ScriptThread(target=run_script,
                              args=(str(script.path), False, script.debug,
                                    script.breakpoints))
        thread.script_path = str(script.path)
        thread.start()

        Python.shared.scriptToRun = None

    sys.stdout.write("")