Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 404 Client Error #39

Open
l0rddarkf0rce opened this issue Aug 24, 2022 · 5 comments
Open

Error 404 Client Error #39

l0rddarkf0rce opened this issue Aug 24, 2022 · 5 comments

Comments

@l0rddarkf0rce
Copy link

I have the following simple code

import upnpclient
def findWiiM():
    WiiMServer = None
    devices = upnpclient.discover()
    for dev in devices:
        if dev.friendly_name == 'WiiM Mini':
            WiiMServer = dev.location
    return WiiMServer

print(findWiiM())

and when I run it I get the following error?

Error '404 Client Error: Not Found for url: http[:]//192.168.1.220:8060/dial/ecp_SCPD.xml' for <upnpclient.ssdp.Entry object at 0x000001F68CB1E310>

Any ideas on how to ignore and/or fix it?

@l0rddarkf0rce
Copy link
Author

The error occurs by just running upnpclient.discover()

@sanderjo
Copy link

Same error here.

$ python3 
Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import upnpclient

>>> devices = upnpclient.discover()
Error '404 Client Error: Not Found for url: http://192.168.178.39:8008/ssdp/notfound' for <upnpclient.ssdp.Entry object at 0x7f098f2ed160>
Error '404 Client Error: Not Found for url: http://192.168.178.37:8008/ssdp/notfound' for <upnpclient.ssdp.Entry object at 0x7f098f1b4c40>
Error '404 Client Error: Not Found for url: http://192.168.178.37:8008/ssdp/notfound' for <upnpclient.ssdp.Entry object at 0x7f098f1b4d60>
Error '404 Client Error: Not Found for url: http://192.168.178.39:8008/ssdp/notfound' for <upnpclient.ssdp.Entry object at 0x7f0991a45d90>
Error '404 Client Error: Not Found for url: http://192.168.178.39:8008/ssdp/notfound' for <upnpclient.ssdp.Entry object at 0x7f098f1b4dc0>
Error '404 Client Error: Not Found for url: http://192.168.178.37:8008/ssdp/notfound' for <upnpclient.ssdp.Entry object at 0x7f098f1b4df0>
Error '404 Client Error: Not Found for url: http://192.168.178.39:8008/ssdp/notfound' for <upnpclient.ssdp.Entry object at 0x7f098f1b4ee0>
Error '404 Client Error: Not Found for url: http://192.168.178.37:8008/ssdp/notfound' for <upnpclient.ssdp.Entry object at 0x7f098f1b4f40>
Error '404 Client Error: Not Found for url: http://192.168.178.39:8008/ssdp/notfound' for <upnpclient.ssdp.Entry object at 0x7f098f1b4fa0>
Error '404 Client Error: Not Found for url: http://192.168.178.37:8008/ssdp/notfound' for <upnpclient.ssdp.Entry object at 0x7f098f1b4fd0>
>>> 


@sanderjo
Copy link

Ugly workaround: temporarily redirect stderror to /dev/null:

safe_stderr = sys.stderr
sys.stderr = open(os.devnull,'w')
devices = upnpclient.discover()
sys.stderr = safe_stderr

@sanderjo
Copy link

sanderjo commented Sep 16, 2022

I assume the error is from:

https://github.com/flyte/upnpclient/blob/develop/upnpclient/ssdp.py#L126

I'm not sure, but maybe you can overwrite that ... ?

        log = _getLogger("ssdp")
        log.error("Error '%s' for %s", exc, entry)

EDIT:
Commenting out that line in .local/lib/python3.8/site-packages/upnpclient/ssdp.py indeed avoids the error message

@sanderjo
Copy link

sanderjo commented Feb 17, 2023

Any feedback on this?

Anything better than the workaround below?

#!/usr/bin/env python3

import upnpclient
import sys, os

# workaround: redirect stderr
safe_stderr = sys.stderr
sys.stderr = open(os.devnull,'w')
devices = upnpclient.discover()
sys.stderr = safe_stderr

for i in devices:
	print(i)
	try:
		print(i.WANIPConn1.GetExternalIPAddress())
	except:
		pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants