Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7c0fb6e

Browse files
committed
Merge pull request #5279 from cgohlke/patch-17
On Windows, use absolute paths to figures in Sphinx documents if necessary
1 parent f529327 commit 7c0fb6e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,12 @@ def run(arguments, content, options, state_machine, state, lineno):
748748
# how to link to files from the RST file
749749
dest_dir_link = os.path.join(relpath(setup.confdir, rst_dir),
750750
source_rel_dir).replace(os.path.sep, '/')
751-
build_dir_link = relpath(build_dir, rst_dir).replace(os.path.sep, '/')
751+
try:
752+
build_dir_link = relpath(build_dir, rst_dir).replace(os.path.sep, '/')
753+
except ValueError:
754+
# on Windows, relpath raises ValueError when path and start are on
755+
# different mounts/drives
756+
build_dir_link = build_dir
752757
source_link = dest_dir_link + '/' + output_base + source_ext
753758

754759
# make figures

0 commit comments

Comments
 (0)