##// END OF EJS Templates
Fix 2 more occurences of Path to use Pathlib,...
Matthias Bussonnier -
Show More
@@ -693,7 +693,7 b' class CodeMagics(Magics):'
693 693 # Quote filenames that may have spaces in them when opening
694 694 # the editor
695 695 quoted = filename = str(filepath.absolute())
696 if ' ' in quoted:
696 if " " in quoted:
697 697 quoted = "'%s'" % quoted
698 698 self.shell.hooks.editor(quoted,lineno)
699 699 except TryNext:
@@ -702,8 +702,8 b' class CodeMagics(Magics):'
702 702
703 703 # XXX TODO: should this be generalized for all string vars?
704 704 # For now, this is special-cased to blocks created by cpaste
705 if args.strip() == 'pasted_block':
706 self.shell.user_ns['pasted_block'] = filepath.read_text()
705 if args.strip() == "pasted_block":
706 self.shell.user_ns["pasted_block"] = filepath.read_text()
707 707
708 708 if 'x' in opts: # -x prevents actual execution
709 709 print()
@@ -713,8 +713,7 b' class CodeMagics(Magics):'
713 713 if not is_temp:
714 714 self.shell.user_ns['__file__'] = filename
715 715 if 'r' in opts: # Untranslated IPython code
716 with filepath.open('r') as f:
717 source = f.read()
716 source = filepath.read_text()
718 717 self.shell.run_cell(source, store_history=False)
719 718 else:
720 719 self.shell.safe_execfile(filename, self.shell.user_ns,
@@ -722,8 +721,7 b' class CodeMagics(Magics):'
722 721
723 722 if is_temp:
724 723 try:
725 with filepath.open() as f:
726 return f.read()
724 return filepath.read_text()
727 725 except IOError as msg:
728 726 if Path(msg.filename) == filepath:
729 727 warn('File not found. Did you forget to save?')
General Comments 0
You need to be logged in to leave comments. Login now