Skip to content

Commit

Permalink
better exec file in legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Aug 13, 2015
1 parent 22b73cf commit ebeea56
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/quorum/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,13 @@ def is_generator(value):
if type(value) in (itertools.chain,): return True
return False

def execfile(path, global_vars, local_vars = None):
def execfile(path, global_vars, local_vars = None, encoding = "utf-8"):
if local_vars == None: local_vars = global_vars
if not PYTHON_3: return _execfile(path, global_vars, local_vars)
file = open(path)
file = open(path, "rb")
try: data = file.read()
finally: file.close()
data = data.decode(encoding)
code = compile(data, path, "exec")
exec(code, global_vars, local_vars)

Expand Down

0 comments on commit ebeea56

Please sign in to comment.