Skip to content

Commit

Permalink
Use pathlib in magics module's execution.py
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksspirit authored and Carreau committed Oct 13, 2020
1 parent 136898e commit 9225195
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion IPython/core/magics/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from IPython.utils.timing import clock, clock2
from warnings import warn
from logging import error
from pathlib import Path
from io import StringIO
from pathlib import Path

Expand Down Expand Up @@ -364,7 +365,10 @@ def _run_with_profiler(self, code, opts, namespace):
f"\n*** Profile stats marshalled to file {repr(dump_file)}.{sys_exit}"
)
if text_file:
Path(text_file).write_text(output)
pfile = Path(text_file)
pfile.touch(exist_ok=True)
pfile.write_text(output)

print(
f"\n*** Profile printout saved to text file {repr(text_file)}.{sys_exit}"
)
Expand Down

0 comments on commit 9225195

Please sign in to comment.