Note that there are some explanatory texts on larger screens.

plurals
  1. POurllib error: cannot fetch html data. Python, Beagle Bone Black
    primarykey
    data
    text
    <p>I was making my project on mac and I tried to do the same things by Beagle Bone Black(BBB). However, I couldn't use urllib in BBB so I am stuck: I cannot go forward.(it is working well in my mac)</p> <p>I tried this simple code as an example: </p> <pre> import urllib conn = urllib.urlopen('http://stackoverflow.com/questions/8479736/using-python-urllib-how-to-avoid-non-html-content') </pre> <p>then this Error occurred:</p> <pre><code>Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; File "/usr/lib/python2.7/urllib.py", line 86, in urlopen return opener.open(url) File "/usr/lib/python2.7/urllib.py", line 207, in open return getattr(self, name)(url) File "/usr/lib/python2.7/urllib.py", line 351, in open_http 'got a bad status line', None) IOError: ('http protocol error', 0, 'got a bad status line', None) </code></pre> <p>I need to fetch a html data for my project. How can I solve this problem? Do you have any ideas ? Thank you.</p> <p>When I tried <code>urllib2</code> I got this:</p> <pre><code>&gt;&gt;&gt; import urllib2 &gt;&gt;&gt; conn = urllib2.urlopen('http://stackoverflow.com/questions/8479736/using-python-urllib-how-to-avoid-non-html-content') Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "/usr/lib/python2.7/urllib2.py", line 400, in open response = self._open(req, data) File "/usr/lib/python2.7/urllib2.py", line 418, in _open '_open', req) File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open return self.do_open(httplib.HTTPConnection, req) File "/usr/lib/python2.7/urllib2.py", line 1180, in do_open r = h.getresponse(buffering=True) File "/usr/lib/python2.7/httplib.py", line 1030, in getresponse response.begin() File "/usr/lib/python2.7/httplib.py", line 407, in begin version, status, reason = self._read_status() File "/usr/lib/python2.7/httplib.py", line 371, in _read_status raise BadStatusLine(line) httplib.BadStatusLine: '' </code></pre> <p>Also I tried this:</p> <pre><code>curl http://stackoverflow.com/questions/8479736/using-python-urllib-how-to-avoid-non-html-content curl: (52) Empty reply from server </code></pre> <p>and this:</p> <pre><code>wget http://stackoverflow.com/questions/8479736/using-python-urllib-how-to-avoid-non-html-content Connecting to stackoverflow.com (198.252.206.16:80) wget: error getting response </code></pre> <p>but they didn't work </p> <p>at home, I also tried and failed but returns a different error:</p> <pre><code>conn = urllib2.urlopen('http://stackoverflow.com/questions/8479736/using-python-urllib-how-to-avoid-non-html-content') Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "/usr/lib/python2.7/urllib2.py", line 400, in open response = self._open(req, data) File "/usr/lib/python2.7/urllib2.py", line 418, in _open '_open', req) File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 1215, in https_open return self.do_open(httplib.HTTPSConnection, req) File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open raise URLError(err) urllib2.URLError: &lt;urlopen error [Errno -2] Name or service not known&gt; </code></pre> <p><strong>environment</strong></p> <pre><code>BBB: Linux beaglebone 3.8.13 #1 SMP Tue Jun 18 02:11:09 EDT 2013 armv7l GNU/Linux python version: 2.7.3 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload