'Execute an existing file'

def execfile(self, filename, source=None):

    if (source is None):
        source = open(filename, 'r').read()
    try:
        code = compile(source, filename, 'exec')
    except (OverflowError, SyntaxError):
        self.tkconsole.resetoutput()
        tkerr = self.tkconsole.stderr
        print >>tkerr, '***    Error    in    script    or    command!\n'
        print >>tkerr, 'Traceback    (most    recent    call    last):'
        InteractiveInterpreter.showsyntaxerror(self, filename)
        self.tkconsole.showprompt()
    else:
        self.runcode(code)
