尝试运行程序时出现此错误:
Traceback (most recent call last):
File "C:/Users/Adasli199/Desktop/Minetek-Testy-Stuff/tools/soldering-iron.py", line 400, in <module>
MCVersionRegEx = cacheMCVersions()
File "C:/Users/Adasli199/Desktop/Minetek-Testy-Stuff/tools/soldering-iron.py", line 141, in cacheMCVersions
feeddata = opener.open(request).read()
File "C:\Python27\lib\urllib2.py", line 404, in open
response = self._open(req, data)
File "C:\Python27\lib\urllib2.py", line 422, in _open
'_open', req)
File "C:\Python27\lib\urllib2.py", line 382, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "C:\Python27\lib\urllib2.py", line 1184, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 1] _ssl.c:510: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error>
我正在尝试获取一些数据数据以帮助在代码的另一部分处理我的RegEx命令,这是它引用的函数抛出错误。
import httplib
import urllib2
def cacheMCVersions():
request = urllib2.Request('https://mcversions.net/')
request.add_header('User-Agent', 'SolderingIron/1.0 +http://tetrarch.co/') # identify ourselves so we don't get blocked
opener = urllib2.build_opener()
feeddata = opener.open(request).read()
在此之后还有一些正则表达式代码来解释数据但我觉得这就是解决问题所需的全部内容。在运行时,https://mcversions.net/已经启动并且仍然是我所知道的,这使得这个错误更加奇怪。
答案 0 :(得分:0)
urllib
在python 2.7.9
上被破坏,在https
次请求时被降低。
Install python 2.7.10 inside a virtual enviornment
它应该有效。您可能需要安装libssl-dev
或openssl
,具体取决于您的Linux平台。