Debian solves the Sphinx exception "cocould not import extension sphinx. builders. linkcheck (exception: cannot import name SSLError )".

Source: Internet
Author: User

Debian solves the Sphinx exception "cocould not import extension sphinx. builders. linkcheck (exception: cannot import name SSLError )".

The following exception occurs when you recently used Sphinx to compile the document:

Extension error:
Cocould not import extension sphworkflow. builders. linkcheck (exception: cannot import name SSLError)

At the beginning, I was a bit confused. It was clear that "sph?. builders. linkcheck" could not be imported, but the error message was "cannot import name SSLError"

Therefore, use the "-P" parameter to enable pdb debugging in case of an exception. The pdb print information is as follows:

Exception occurred while building, starting debugger:
Traceback (most recent call last ):
File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.5b1-py2.7.egg/sphashes/fig. py", line 295, in main
Opts. warningiserror, opts. tags, opts. verbosity, opts.jobs)
File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.5b1-py2.7.egg/sphpackages/application. py", line 189, in _ init __
Self. setup_extension (extension)
File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.5b1-py2.7.egg/sphages/application. py", line 514, in setup_extension
Err)
ExtensionError: cocould not import extension sphenders. builders. linkcheck (exception: cannot import name SSLError)

You can see the error is in "application. py", so open the file to find out, the source code is as follows:

Further print "extension" and "err" in pdb"

Now we can know that importerror was encountered during the import process, but we don't know what the error is. We just need to start another python command line and directly import the extension "sphworkflow. builders. "linkcheck", the following error is returned:

We can see that the cause of the error is that you cannot import "SSLError" from "requests. packages. urllib3.exceptions". It is verified that you can import "SSLError" in "requests. exceptions"

Most online searches only mention the import of "SSLError" from "requests. exceptions ". Since Sphinx is the latest version, I suspect the version may be incompatible.

Check the requests version and find that requests is not the latest version (the latest version on the official website is v2.12.1 ):

I further confirmed on the official website that the SSLError code on the official website has indeed changed:

At this point, it is confirmed that the "SSLError" position (import method) has been changed during the requests version update process, and the problem is resolved after the requests is upgraded to the latest version.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.