dwighthubbard / python-dlipower

Python modules to manage Digital Loggers Web Power Switch
Other
54 stars 35 forks source link

TypeError: object of type 'NoneType' has no len() #62

Open ninjakappa007 opened 2 days ago

ninjakappa007 commented 2 days ago

code snippet :

import dlipower
switch = dlipower.PowerSwitch(hostname="192.168.1.21", userid="admin", password='11112222')
switch.on(5)

error faced :

Traceback (most recent call last):
  File "/home/ANT.AMAZON.COM/nayaashb/kats-agent/DeCAFAwil_Matter/src/DeCAFtests/decaf_tests/wifi/iot_test/test.py", line 5, in <module>
    switch.on(5)
  File "/home/ANT.AMAZON.COM/nayaashb/.local/lib/python3.10/site-packages/dlipower/dlipower.py", line 465, in on
    self.geturl(url='outlet?%d=ON' % self.determine_outlet(outlet))
  File "/home/ANT.AMAZON.COM/nayaashb/.local/lib/python3.10/site-packages/dlipower/dlipower.py", line 427, in determine_outlet
    if outlet_int <= 0 or outlet_int > self.__len__():
  File "/home/ANT.AMAZON.COM/nayaashb/.local/lib/python3.10/site-packages/dlipower/dlipower.py", line 269, in __len__
    self.__len = len(self.statuslist())
TypeError: object of type 'NoneType' has no len()