Show More
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | # coding: utf-8 |
|
2 | 2 | """Compatibility tricks for Python 3. Mainly to do with unicode.""" |
|
3 | import __builtin__ | |
|
3 | 4 | import functools |
|
4 | 5 | import sys |
|
5 | 6 | import re |
@@ -151,6 +152,7 b' else:' | |||
|
151 | 152 | Accepts a string or a function, so it can be used as a decorator.""" |
|
152 | 153 | return s.format(u='u') |
|
153 | 154 | |
|
155 | if sys.platform == 'win32': | |
|
154 | 156 | def execfile(fname, glob, loc=None): |
|
155 | 157 | loc = loc if (loc is not None) else glob |
|
156 | 158 | scripttext = file(fname).read() |
@@ -161,3 +163,10 b' else:' | |||
|
161 | 163 | else: |
|
162 | 164 | filename = fname |
|
163 | 165 | exec compile(scripttext, filename, 'exec') in glob, loc |
|
166 | else: | |
|
167 | def execfile(fname, glob, loc=None): | |
|
168 | if isinstance(fname, unicode): | |
|
169 | filename = fname.encode(sys.getfilesystemencoding()) | |
|
170 | else: | |
|
171 | filename = fname | |
|
172 | __builtin__.execfile(filename, glob, loc) |
General Comments 0
You need to be logged in to leave comments.
Login now