##// END OF EJS Templates
use pathlib.Path in demo.py
Samreen Zarroug -
Show More
@@ -184,6 +184,7 b' import re'
184 import shlex
184 import shlex
185 import sys
185 import sys
186 import pygments
186 import pygments
187 from pathlib import Path
187
188
188 from IPython.utils.text import marquee
189 from IPython.utils.text import marquee
189 from IPython.utils import openpy
190 from IPython.utils import openpy
@@ -403,8 +404,8 b' class Demo(object):'
403 index -= 1
404 index -= 1
404
405
405 filename = self.shell.mktempfile(self.src_blocks[index])
406 filename = self.shell.mktempfile(self.src_blocks[index])
406 self.shell.hooks.editor(filename,1)
407 self.shell.hooks.editor(filename, 1)
407 with open(filename, 'r') as f:
408 with open(Path(filename), "r") as f:
408 new_block = f.read()
409 new_block = f.read()
409 # update the source and colored block
410 # update the source and colored block
410 self.src_blocks[index] = new_block
411 self.src_blocks[index] = new_block
General Comments 0
You need to be logged in to leave comments. Login now