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