linkchecker
linkchecker copied to clipboard
ImportError: cannot import name get_subj_alt_name
linkchecker fails on HTTPS URLs in Debian jessie and unstable (wheezy works):
$ linkchecker --version
INFO 2014-12-12 13:42:11,157 MainThread Checking intern URLs only; use --check-extern to check extern URLs.
LinkChecker 9.3 released 16.7.2014
Copyright (C) 2000-2014 Bastian Kleineidam
$ linkchecker -Dall https://www.google.com
[...]
File "/usr/lib/python2.7/dist-packages/linkcheck/httputil.py", line 35, in x509_to_dict
line: from requests.packages.urllib3.contrib.pyopenssl import get_subj_alt_name
locals:
requests = <not found>
requests.packages = <not found>
requests.packages.urllib3 = <not found>
requests.packages.urllib3.contrib = <not found>
requests.packages.urllib3.contrib.pyopenssl = <not found>
get_subj_alt_name = <not found>
ImportError: cannot import name get_subj_alt_name
System info:
LinkChecker 9.3
Released on: 16.7.2014
Python 2.7.9 (default, Dec 11 2014, 08:58:12)
[GCC 4.9.2] on linux2
Requests: 2.4.3
Qt: 4.8.6 / PyQt: 4.11.2
Modules: Sqlite, Gconf
Local time: 2014-12-12 13:41:22+003
sys.argv: ['/usr/bin/linkchecker', '-Dall', 'https://www.google.com']
LANGUAGE = 'en_US:en'
LANG = 'en_US.UTF-8'
Default locale: ('en', 'UTF-8')
******** LinkChecker internal error, over and out ********
WARNING 2014-12-12 13:41:22,177 CheckThread-http://www.google.com/maps/views/sitemap.xml internal error occurred
Full debug output here
me too, with https://docs.arangodb.com/
ImportError: cannot import name get_subj_alt_name System info: LinkChecker 9.3 Released on: 16.7.2014 Python 2.7.9 (default, Mar 1 2015, 12:57:24) [GCC 4.9.2] on linux2 Requests: 2.4.3 Statistics: Downloaded: 0B. No statistics available since no URLs were checked. INFO 2015-03-23 16:16:08,594 MainThread Checking intern URLs only; use --check-extern to check extern URLs. LinkChecker 9.3 Copyright (C) 2000-2014 Bastian Kleineidam
Me to - appears to be all https sites
Wondering if it is a missing dependency?
Not sure. I tried manually installing python-urllib3
, python-openssl
, python3-openssl
, as they looked like the obvious candidates for HTTPS connections failing due to an apparently missing library, but didn't seem to fix my Debian linkchecker.
So, I tried to
apt-get install python-urllib3 python-openssl python3-openssl
but it doesn't fix the issue for me.
Hi.
I suggest this change the code of x509_to_dict in /usr/lib/python2.7/dist-packages/linkcheck/httputil.py
By
def x509_to_dict(x509):
"""Parse a x509 pyopenssl object to a dictionary with keys
subject, subjectAltName and optional notAfter.
"""
#from requests.packages.urllib3.contrib.pyopenssl import get_subj_alt_name
import requests.packages.urllib3.contrib.pyopenssl as SSL
res = {
'subject': (
(('commonName', x509.get_subject().CN),),
),
'subjectAltName': [
('DNS', value)
for value in SSL.get_subj_alt_name(x509)
]
}
Linkchecker work fine now.
CHECK! wfm too now.
GwenaelPellenMatelli's patch above also seems to fix the problem for me (LinkChecker 9.3 released 16.7.2014, as packaged for Debian 8).
this is fixed in #656
This error still exists as of yesterday in Ubuntu 15.04. Apparently the Debian Sid version has the patch in it as a NMU, so I installed the Sid .deb and it now works.
This error still affects Debian Jessie, as of today.
@SilkAndSlug i could try to make a stable update for this, but i wonder if people can just use w3c-checker instead in jessie...?
@anarcat : I upgraded to 9.3-4 (Debian Testing), and this problem's gone away.
@SilkAndSlug yes - i had fixed that in Debian in this upload which was migrated to testing end of may.
i'll see if i can make the necessary arrangements to fix this in jessie.
See #839242 for the jessie update.
... and it is now in stable-proposed-updates, which you can enable on your jessie machines already, or wait for the next jessie point release.
Thank you for the issue report. Sadly this project is dead, and a new team is around with https://github.com/linkcheck/linkchecker for more details please see: #708 Also please close this issue and report it freshly on the new repo https://github.com/linkcheck/linkchecker/issues if your issue still persists