2

In order to be able to reference standard python documentation I have added to my config file the following:

import os
import sys
sys.path.insert(0, 'C:/ProgramData/Anaconda3/lib/site-packages')
sys.path.insert(0, os.path.abspath('../..'))
master_doc = 'index'
extensions = ['sphinx.ext.intersphinx']
intersphinx_mapping = {'python': ('https://docs.python.org/3.6', None)}

I have a rst file that makes reference to a python function as:

See :py:func:`io.open`.

When the documentation is built, it correctly recognizes io.open as an external function, creates a link, and when I pass the mouse over it shows the message (in Python 3.6), so I believe it is somehow working.

However, the link that it uses is:

file:///C:/mylib/docs/build/python/library/io.html#io.open

instead of:

https://docs.python.org/3.6/library/io.html#io.open

Am I missing something extra in the config? What am I doing wrong?

Diego F Medina
  • 429
  • 3
  • 14
  • That is correct configuration and syntax. I just tried it using Sphinx 3.0.x on macOS, and built docs with the correct link. Perhaps do a `make clean` to purge an old build file? Or check that you are viewing the correct file in the proper location? – Steve Piercy May 14 '20 at 11:27
  • @StevePiercy Just did but there is no change. I am using Sphinx v1.6.6 on Win10. I also added the rest of the config file, not sure if the other part of the setup conflicts with intersphinx. – Diego F Medina May 14 '20 at 17:57
  • I don't see an issue with the config. Try upgrading Sphinx, else you can search the Sphinx issue tracker. – Steve Piercy May 14 '20 at 22:42
  • Do you actually have a local build of the standard documentation in file:///C:/mylib/docs/build/python? What happens if you delete it? – mzjn May 15 '20 at 14:23
  • @mzjn No I don't. It creates a link to a non existing file. – Diego F Medina May 15 '20 at 17:01

0 Answers0