From 2e0519cfa9230ab05d383195624379e6668c7553 2020-09-22 04:10:25 From: Inception95 Date: 2020-09-22 04:10:25 Subject: [PATCH] Use pathlib in page.py --- diff --git a/IPython/core/page.py b/IPython/core/page.py index 0752909..3db9c60 100644 --- a/IPython/core/page.py +++ b/IPython/core/page.py @@ -196,19 +196,19 @@ def pager_page(strng, start=0, screen_lines=0, pager_cmd=None): retval = 1 else: fd, tmpname = tempfile.mkstemp('.txt') - tmppath = + tmppath = Path(tmpname) try: os.close(fd) - with open(tmpname, 'wt') as tmpfile: + with tmppath.open('wt') as tmpfile: tmpfile.write(strng) - cmd = "%s < %s" % (pager_cmd, tmpname) + cmd = "%s < %s" % (pager_cmd, tmppath) # tmpfile needs to be closed for windows if os.system(cmd): retval = 1 else: retval = None finally: - os.remove(tmpname) + Path.unlink(tmppath) else: try: retval = None