Skip to content

Commit

Permalink
core.magics.execution: use pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMino committed Oct 11, 2020
1 parent 70f5698 commit eba2b69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions IPython/core/magics/execution.py
Expand Up @@ -40,6 +40,7 @@
from warnings import warn
from logging import error
from io import StringIO
from pathlib import Path

if sys.version_info > (3,8):
from ast import Module
Expand Down Expand Up @@ -362,8 +363,7 @@ def _run_with_profiler(self, code, opts, namespace):
print('\n*** Profile stats marshalled to file',\
repr(dump_file)+'.',sys_exit)
if text_file:
with open(text_file, 'w') as pfile:
pfile.write(output)
Path(text_file).write_text(output)
print('\n*** Profile printout saved to text file',\
repr(text_file)+'.',sys_exit)

Expand Down Expand Up @@ -724,7 +724,7 @@ def run(self, parameter_s='', runner=None,
sys.argv = [filename] + args # put in the proper filename

if 'n' in opts:
name = os.path.splitext(os.path.basename(filename))[0]
name = Path(filename).stem
else:
name = '__main__'

Expand Down

0 comments on commit eba2b69

Please sign in to comment.