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

IndexError: list index out of range #11

Open
2004seraph opened this issue Aug 21, 2020 · 4 comments
Open

IndexError: list index out of range #11

2004seraph opened this issue Aug 21, 2020 · 4 comments

Comments

@2004seraph
Copy link

I try to scan my home network with:
upnp = upnpy.UPnP()
upnp.discover()

But I get the error:

Traceback (most recent call last):
File "D:\Programming\WongoMessenger\wongoIM.pyw", line 15, in
upnp.discover()
File "D:\Programming\WongoMessenger\upnpy\upnp\UPnP.py", line 33, in discover
for device in self.ssdp.m_search(discover_delay=delay, st='upnp:rootdevice', **headers):
File "D:\Programming\WongoMessenger\upnpy\ssdp\SSDPRequest.py", line 50, in m_search
devices = self._send_request(self._get_raw_request())
File "D:\Programming\WongoMessenger\upnpy\ssdp\SSDPRequest.py", line 100, in _send_request
device = SSDPDevice(addr, response.decode())
File "D:\Programming\WongoMessenger\upnpy\ssdp\SSDPDevice.py", line 87, in init
self._get_services_request()
File "D:\Programming\WongoMessenger\upnpy\ssdp\SSDPDevice.py", line 23, in wrapper
return func(device, *args, **kwargs)
File "D:\Programming\WongoMessenger\upnpy\ssdp\SSDPDevice.py", line 54, in wrapper
return func(instance, *args, **kwargs)
File "D:\Programming\WongoMessenger\upnpy\ssdp\SSDPDevice.py", line 173, in _get_services_request
device_services[parsed_service_id] = self.Service(
File "D:\Programming\WongoMessenger\upnpy\ssdp\SSDPDevice.py", line 259, in init
self._get_actions_request()
File "D:\Programming\WongoMessenger\upnpy\ssdp\SSDPDevice.py", line 39, in wrapper
return func(service, *args, **kwargs)
File "D:\Programming\WongoMessenger\upnpy\ssdp\SSDPDevice.py", line 331, in _get_actions_request
argument_name = argument.getElementsByTagName('name')[0].firstChild.nodeValue
IndexError: list index out of range

@2004seraph
Copy link
Author

I updated from 1.1.6 to 1.1.8 but I got another error with the same code:

AttributeError: 'NoneType' object has no attribute 'nodeValue'

@sanderjo
Copy link

sanderjo commented Jan 1, 2025

FWIW: I've got the same Traceback with upnp 1.1.8.

The traceback occurs immediatly, so not after discovering stuff.

sander@zwarte:~$ python3 -m venv venv-upnpy

sander@zwarte:~$ venv-upnpy/bin/python -m pip install upnpy
Collecting upnpy
  Using cached UPnPy-1.1.8-py3-none-any.whl
Installing collected packages: upnpy
Successfully installed upnpy-1.1.8

sander@zwarte:~$ venv-upnpy/bin/python
Python 3.12.3 (main, Nov  6 2024, 18:32:19) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import upnpy
>>> upnp = upnpy.UPnP()
>>> devices = upnp.discover()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sander/venv-upnpy/lib/python3.12/site-packages/upnpy/upnp/UPnP.py", line 33, in discover
    for device in self.ssdp.m_search(discover_delay=delay, st='upnp:rootdevice', **headers):
  File "/home/sander/venv-upnpy/lib/python3.12/site-packages/upnpy/ssdp/SSDPRequest.py", line 50, in m_search
    devices = self._send_request(self._get_raw_request())
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sander/venv-upnpy/lib/python3.12/site-packages/upnpy/ssdp/SSDPRequest.py", line 100, in _send_request
    device = SSDPDevice(addr, response.decode())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sander/venv-upnpy/lib/python3.12/site-packages/upnpy/ssdp/SSDPDevice.py", line 87, in __init__
    self._get_services_request()
  File "/home/sander/venv-upnpy/lib/python3.12/site-packages/upnpy/ssdp/SSDPDevice.py", line 23, in wrapper
    return func(device, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sander/venv-upnpy/lib/python3.12/site-packages/upnpy/ssdp/SSDPDevice.py", line 54, in wrapper
    return func(instance, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sander/venv-upnpy/lib/python3.12/site-packages/upnpy/ssdp/SSDPDevice.py", line 168, in _get_services_request
    service_id = service.getElementsByTagName('serviceId')[0].firstChild.nodeValue
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
>>> 

No problem with CLI tool mini-upnnc and with python module https://github.com/flyte/upnpclient. And yes, there is UPnP IGD on my network: my Internet gateway.

@2004seraph
Copy link
Author

I think this project is dead bro

@2004seraph 2004seraph reopened this Jan 1, 2025
@sanderjo
Copy link

sanderjo commented Jan 1, 2025

I think this project is dead bro

Looks like it, bro: last commit Aug 15, 2020 ...

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