##// END OF EJS Templates
Fix for %run on a Python file using non-default encoding.
Thomas Kluyver -
Show More
@@ -240,3 +240,10 b' tclass.py: deleting object: C-third'
240 240 _ip.run_cell("zz = 23")
241 241 _ip.magic('run -i %s' % self.fname)
242 242 tt.assert_equals(_ip.user_ns['yy'], 23)
243
244 def test_unicode(self):
245 """Check that files in odd encodings are accepted."""
246 mydir = os.path.dirname(__file__)
247 na = os.path.join(mydir, 'nonascii.py')
248 _ip.magic('run %s' % na)
249 tt.assert_equals(_ip.user_ns['u'], u'Ўт№Ф')
@@ -70,7 +70,7 b' if sys.version_info[0] >= 3:'
70 70
71 71 def execfile(fname, glob, loc=None):
72 72 loc = loc if (loc is not None) else glob
73 exec compile(open(fname).read(), fname, 'exec') in glob, loc
73 exec compile(open(fname, 'rb').read(), fname, 'exec') in glob, loc
74 74
75 75 # Refactor print statements in doctests.
76 76 _print_statement_re = re.compile(r"\bprint (?P<expr>.*)$", re.MULTILINE)
General Comments 0
You need to be logged in to leave comments. Login now