question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

urllib.error.HTTPError: HTTP Error 404: Not Found

See original GitHub issue

Sometimes it finds more hosts, but mostly it just fails with the below stacktrace.

Ubuntu 18.04 w/ Python3 VENV, Python v3.6.9

Traceback (most recent call last):
  File "CallStranger.py", line 113, in <module>
    devices = upnp.discover()
  File "/opt/callstranger/upnpy/upnp/UPnP.py", line 33, in discover
    for device in self.ssdp.m_search(discover_delay=delay, st='upnp:rootdevice', **headers):
  File "/opt/callstranger/upnpy/ssdp/SSDPRequest.py", line 49, in m_search
    devices = self._send_request(self._get_raw_request())
  File "/opt/callstranger/upnpy/ssdp/SSDPRequest.py", line 100, in _send_request
    device = SSDPDevice(addr, response.decode())
  File "/opt/callstranger/upnpy/ssdp/SSDPDevice.py", line 82, in __init__
    self._get_description_request(utils.parse_http_header(response, 'Location'))
  File "/opt/callstranger/upnpy/ssdp/SSDPDevice.py", line 115, in _get_description_request
    device_description = utils.make_http_request(url).read()
  File "/opt/callstranger/upnpy/utils.py", line 80, in make_http_request
    return urllib.request.urlopen(request)
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
yunuscadircicommented, Jun 12, 2020

Hi there are too many devices. I broaded exception handling. can you try again?

0reactions
dffvbcommented, Jun 13, 2020

So the outcome is now stable with 7 upnp devices, however I still get the 404

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python: urllib.error.HTTPError: HTTP Error 404: Not Found
This code will catch the 404 error which was the reason you got an error and ignore it just in case you go...
Read more >
[BUG] urllib.error.HTTPError: HTTP Error 404: Not Found #1021
Describe the bug urllib.error.HTTPError: HTTP Error 404: Not Found cannot download video or list out streams (sometimes the download did ...
Read more >
urllib.error.HTTPError: HTTP Error 404: Not Found - Ask Ubuntu
Your problem is that you're not adding data as a query parameter, indicated by adding a ? after /search. Here is your code...
Read more >
urllib.error.HTTPError: HTTP Error 404: Not Found - YouTube
Topic : urllib. error. HTTPError : HTTP Error 404 : Not ...
Read more >
HTTPError: HTTP Error 404: Not Found in python 3
import urllib.request def get_site_html(url): source = urllib.request.urlopen(url).read() return source. I am trying to create this function but it throws ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found