Exemple #1
0
 def execfile(fname, glob=None, loc=None, compiler=None):
     if isinstance(fname, unicode):
         filename = fname.encode(sys.getfilesystemencoding())
     else:
         filename = fname
     where = [ns for ns in [glob, loc] if ns is not None]
     if compiler is None:
         builtin_mod.execfile(filename, *where)
     else:
         scripttext = builtin_mod.open(fname).read().rstrip() + "\n"
         exec(compiler(scripttext, filename, "exec"), glob, loc)
Exemple #2
0
 def execfile(fname, glob=None, loc=None, compiler=None):
     if isinstance(fname, unicode):
         filename = fname.encode(sys.getfilesystemencoding())
     else:
         filename = fname
     where = [ns for ns in [glob, loc] if ns is not None]
     if compiler is None:
         builtin_mod.execfile(filename, *where)
     else:
         scripttext = builtin_mod.open(fname).read().rstrip() + '\n'
         exec(compiler(scripttext, filename, 'exec'), glob, loc)
Exemple #3
0
    def dispatch_script(msg, ses):
        # print("leoremote.py: dispatch script", msg)
        fd, pth = tempfile.mkstemp(suffix='.py')
        f = os.fdopen(fd,"w")
        f.write(msg)
        f.close()
        # first run
        if 'pydict' not in ses:
            ses['pydict'] = {'g' : g }

        # print("run file",pth)
        if g.isPython3:
            g.trace('no python 3 support')
            # exec(compile(script, scriptFile, 'exec'), d)
        else:
            builtins.execfile(pth, ses['pydict'])
Exemple #4
0
    def dispatch_script(msg, ses):
        # print("leoremote.py: dispatch script", msg)
        fd, pth = tempfile.mkstemp(suffix='.py')
        f = os.fdopen(fd, "w")
        f.write(msg)
        f.close()
        # first run
        if 'pydict' not in ses:
            ses['pydict'] = {'g': g}

        # print("run file",pth)
        if g.isPython3:
            g.trace('no python 3 support')
            # exec(compile(script, scriptFile, 'exec'), d)
        else:
            builtins.execfile(pth, ses['pydict'])
Exemple #5
0
 def execfile(fname, *where):
     if isinstance(fname, unicode):
         filename = fname.encode(sys.getfilesystemencoding())
     else:
         filename = fname
     builtin_mod.execfile(filename, *where)
Exemple #6
0
 def execfile(fname, *where):
     if isinstance(fname, unicode):
         filename = fname.encode(sys.getfilesystemencoding())
     else:
         filename = fname
     builtin_mod.execfile(filename, *where)
Exemple #7
0
def run_remote_script(fname):

    # c and p are ambiguous for remote script
    print("rrs")
    d = {'g': g }
    builtins.execfile(fname, d)
Exemple #8
0
def run_remote_script(fname):

    # c and p are ambiguous for remote script
    print("rrs")
    d = {'g': g}
    builtins.execfile(fname, d)