发生urlopen错误EOF违反协议

发生urlopen错误EOF违反协议

本文介绍了macOS Sierra/Python2.7.13 URLError:<发生urlopen错误EOF违反协议(_ssl.c:661)>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在搜索/尝试在Stack Overflow上可以找到的所有内容,但并不高兴.我是Python的新手,所以为自己的无知而向我道歉,但是非常渴望/很兴奋地学习.

I have been searching/trying everything I could find on Stack Overflow, but no joy. I am new to Python, so I apologize now for my ignorance, but very eager/excited to learn.

macOS Sierra v10.12.5 (early 2011)
Python v2.7.13
urllib==1.21.1
urllib2==1498656401.94
urllib3==1.21.1
Homebrew installed

这是我收到的错误:

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:39:47)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>>

Traceback (most recent call last):
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",
l    ine 154, in urlopen
    return opener.open(url, data, timeout)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",
line 429, in open
    response = self._open(req, data)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",
line 447, in _open
    '_open', req)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",
line 407, in _call_chain
    result = func(*args)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",
line 1241, in https_open
    context=self._context)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",
line 1198, in do_open
    raise URLError(err)
URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:661)>
>>>

推荐答案

我有两个问题. @Steffen_Ullrich上面提供的步骤解决了问题的上半部分.这是第二部分,谢谢@zwer!

I had a two fold problem. The steps provided above by @Steffen_Ullrich solved the first half of the issue. Here is the second half, thank you @zwer!

Python和'print ssl.OPENSSL_VERSION'打印错误的版本

这篇关于macOS Sierra/Python2.7.13 URLError:&lt;发生urlopen错误EOF违反协议(_ssl.c:661)&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 12:42