From 74844174fdd256c523dd003ddb7c95eff5026246 2020-10-22 20:12:32 From: Samreen Zarroug Date: 2020-10-22 20:12:32 Subject: [PATCH] use pathlib.Path in demo.py --- diff --git a/IPython/lib/demo.py b/IPython/lib/demo.py index 0b19c41..bfef82f 100644 --- a/IPython/lib/demo.py +++ b/IPython/lib/demo.py @@ -184,6 +184,7 @@ import re import shlex import sys import pygments +from pathlib import Path from IPython.utils.text import marquee from IPython.utils import openpy @@ -403,8 +404,8 @@ class Demo(object): index -= 1 filename = self.shell.mktempfile(self.src_blocks[index]) - self.shell.hooks.editor(filename,1) - with open(filename, 'r') as f: + self.shell.hooks.editor(filename, 1) + with open(Path(filename), "r") as f: new_block = f.read() # update the source and colored block self.src_blocks[index] = new_block