##// END OF EJS Templates
Fix %loadpy for Python 3.
Thomas Kluyver -
Show More
@@ -2163,11 +2163,12 Currently the magic system has the following functions:\n"""
2163 if remote_url:
2163 if remote_url:
2164 import urllib2
2164 import urllib2
2165 fileobj = urllib2.urlopen(arg_s)
2165 fileobj = urllib2.urlopen(arg_s)
2166 linesource = fileobj.read().decode('utf-8', 'replace').splitlines()
2166 else:
2167 else:
2167 fileobj = open(arg_s)
2168 fileobj = linesource = open(arg_s)
2168
2169
2169 # Strip out encoding declarations
2170 # Strip out encoding declarations
2170 lines = [l for l in fileobj if not _encoding_declaration_re.match(l)]
2171 lines = [l for l in linesource if not _encoding_declaration_re.match(l)]
2171 fileobj.close()
2172 fileobj.close()
2172
2173
2173 self.set_next_input(os.linesep.join(lines))
2174 self.set_next_input(os.linesep.join(lines))
General Comments 0
You need to be logged in to leave comments. Login now