##// END OF EJS Templates
core.magics.execution: use pathlib
Blazej Michalik -
Show More
@@ -40,6 +40,7 b' from IPython.utils.timing import clock, clock2'
40 40 from warnings import warn
41 41 from logging import error
42 42 from io import StringIO
43 from pathlib import Path
43 44
44 45 if sys.version_info > (3,8):
45 46 from ast import Module
@@ -362,8 +363,7 b' class ExecutionMagics(Magics):'
362 363 print('\n*** Profile stats marshalled to file',\
363 364 repr(dump_file)+'.',sys_exit)
364 365 if text_file:
365 with open(text_file, 'w') as pfile:
366 pfile.write(output)
366 Path(text_file).write_text(output)
367 367 print('\n*** Profile printout saved to text file',\
368 368 repr(text_file)+'.',sys_exit)
369 369
@@ -724,7 +724,7 b' class ExecutionMagics(Magics):'
724 724 sys.argv = [filename] + args # put in the proper filename
725 725
726 726 if 'n' in opts:
727 name = os.path.splitext(os.path.basename(filename))[0]
727 name = Path(filename).stem
728 728 else:
729 729 name = '__main__'
730 730
General Comments 0
You need to be logged in to leave comments. Login now