kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
304 stars 59 forks source link

list index out of range in V1.1.0 #26

Closed ReneNulschDE closed 4 years ago

ReneNulschDE commented 4 years ago

First of all thank you for this great component.

I have a problem with the new version 1.1.0.

(venv37) rene@DERNHASS01:~/home-assistant$ fritzconnection -i XXX -p XXX

FritzConnection v1.1
Traceback (most recent call last):
  File "/home/rene/home-assistant/venv37/bin/fritzconnection", line 8, in <module>
    sys.exit(main())
  File "/home/rene/home-assistant/venv37/lib/python3.7/site-packages/fritzconnection/cli/fritzinspection.py", line 163, in main
    run_inspector(inspector, args)
  File "/home/rene/home-assistant/venv37/lib/python3.7/site-packages/fritzconnection/cli/fritzinspection.py", line 143, in run_inspector
    inspector.view_header()
  File "/home/rene/home-assistant/venv37/lib/python3.7/site-packages/fritzconnection/cli/fritzinspection.py", line 36, in view_header
    print(self.fc)
  File "/home/rene/home-assistant/venv37/lib/python3.7/site-packages/fritzconnection/core/fritzconnection.py", line 90, in __repr__
    return  f"{self.modelname} at ip {self.soaper.address}\n"\
  File "/home/rene/home-assistant/venv37/lib/python3.7/site-packages/fritzconnection/core/fritzconnection.py", line 105, in modelname
    return self.device_manager.modelname
  File "/home/rene/home-assistant/venv37/lib/python3.7/site-packages/fritzconnection/core/devices.py", line 34, in modelname
    return self.descriptions[0].device_model_name
IndexError: list index out of range

The same command in V1.0.1 works without error:

(vnev) rene@DERNHASS01:~/projects/tests$ fritzconnection -i XXX -p XXX

FritzConnection v1.0.1
FRITZ!Box 7590 at ip 192.168.178.1
FRITZ!OS: 7.12

If I do not deliver the IP address then the error is the same, but takes much longer.

(vnev) rene@DERNHASS01:~/projects/tests$ fritzconnection

FritzConnection v1.0.1
Traceback (most recent call last):
  File "/home/rene/projects/tests/vnev/bin/fritzconnection", line 10, in <module>
    sys.exit(main())
  File "/home/rene/projects/tests/vnev/lib/python3.7/site-packages/fritzconnection/cli/fritzinspection.py", line 163, in main
    run_inspector(inspector, args)
  File "/home/rene/projects/tests/vnev/lib/python3.7/site-packages/fritzconnection/cli/fritzinspection.py", line 143, in run_inspector
    inspector.view_header()
  File "/home/rene/projects/tests/vnev/lib/python3.7/site-packages/fritzconnection/cli/fritzinspection.py", line 36, in view_header
    print(self.fc)
  File "/home/rene/projects/tests/vnev/lib/python3.7/site-packages/fritzconnection/core/fritzconnection.py", line 83, in __repr__
    return  f"{self.modelname} at ip {self.soaper.address}\n"\
  File "/home/rene/projects/tests/vnev/lib/python3.7/site-packages/fritzconnection/core/fritzconnection.py", line 98, in modelname
    return self.device_manager.modelname
  File "/home/rene/projects/tests/vnev/lib/python3.7/site-packages/fritzconnection/core/devices.py", line 33, in modelname
    return self.descriptions[0].device_model_name
IndexError: list index out of range

Environment: Linux Mint 19.1 Python: 3.7.6

ReneNulschDE commented 4 years ago

looks like the new port handling is the source of the problem. If I add the port the function works as expected.

(venv37) rene@DERNHASS01:~/home-assistant$ fritzconnection -i 192.168.178.1 -p XXX --port 49000

FritzConnection v1.1
FRITZ!Box 7590 at ip 192.168.178.1
FRITZ!OS: 7.12
kbr commented 4 years ago

Thank you for the report. Yes, the port was the problem. Introduced with 1.1 and patched with 1.1.1. Fixed now.