##// END OF EJS Templates
Use the with statement to open a file.
Abhinav Upadhyay -
Show More
@@ -402,9 +402,8 b' class CodeMagics(Magics):'
402 self.shell.hooks.editor(filename)
402 self.shell.hooks.editor(filename)
403
403
404 # and make a new macro object, to replace the old one
404 # and make a new macro object, to replace the old one
405 mfile = open(filename)
405 with open(filename) as mfile:
406 mvalue = mfile.read()
406 mvalue = mfile.read()
407 mfile.close()
408 self.shell.user_ns[mname] = Macro(mvalue)
407 self.shell.user_ns[mname] = Macro(mvalue)
409
408
410 @skip_doctest
409 @skip_doctest
General Comments 0
You need to be logged in to leave comments. Login now