From 799e364240be645cd46167a10ef07d6aa7941b70 2020-05-28 00:05:27 From: Blake Griffin Date: 2020-05-28 00:05:27 Subject: [PATCH] Fixed bug on windows where relative image path has wrong direction slashes --- diff --git a/IPython/sphinxext/ipython_directive.py b/IPython/sphinxext/ipython_directive.py index 0481624..3d5b376 100644 --- a/IPython/sphinxext/ipython_directive.py +++ b/IPython/sphinxext/ipython_directive.py @@ -419,8 +419,8 @@ class EmbeddedSphinxShell(object): # insert relative path to image file in source # as absolute path for Sphinx # sphinx expects a posix path, even on Windows - posix_path = pathlib.Path(savefig_dir,filename).as_posix() - outfile = '/' + os.path.relpath(posix_path, source_dir) + path = pathlib.Path(savefig_dir, filename) + outfile = '/' + path.relative_to(source_dir).as_posix() imagerows = ['.. image:: %s' % outfile]