diff options
Diffstat (limited to 'python/helpers/pydev/_pydev_execfile.py')
-rw-r--r-- | python/helpers/pydev/_pydev_execfile.py | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/python/helpers/pydev/_pydev_execfile.py b/python/helpers/pydev/_pydev_execfile.py deleted file mode 100644 index d60d7ed94bb0..000000000000 --- a/python/helpers/pydev/_pydev_execfile.py +++ /dev/null @@ -1,38 +0,0 @@ -#We must redefine it in Py3k if it's not already there -def execfile(file, glob=None, loc=None): - if glob is None: - import sys - glob = sys._getframe().f_back.f_globals - if loc is None: - loc = glob - stream = open(file, 'rb') - try: - encoding = None - #Get encoding! - for _i in range(2): - line = stream.readline() #Should not raise an exception even if there are no more contents - #Must be a comment line - if line.strip().startswith(b'#'): - #Don't import re if there's no chance that there's an encoding in the line - if b'coding' in line: - import re - p = re.search(br"coding[:=]\s*([-\w.]+)", line) - if p: - try: - encoding = p.group(1).decode('ascii') - break - except: - encoding = None - finally: - stream.close() - - if encoding: - stream = open(file, encoding=encoding) - else: - stream = open(file) - try: - contents = stream.read() - finally: - stream.close() - - exec(compile(contents+"\n", file, 'exec'), glob, loc) #execute the script
\ No newline at end of file |