cyrils / renogy-bt

Python library to read Renogy compatible BT-1 or BT-2 bluetooth modules using Raspberry Pi.
GNU General Public License v3.0
76 stars 27 forks source link

Solution to : AttributeError: 'list' object has no attribute 'get' #36

Closed phildabill closed 8 months ago

phildabill commented 8 months ago

Howdy,

I consider myself an idiot. I have practically zero Python experience but did code a bit back at uni.

While trying to run example.py as instructed with a config file as an argument, I would always get: config_file = sys.argv.get[1] if len(sys.argv) > 1 else 'config.ini' ^^^^^^^^^^^^ AttributeError: 'list' object has no attribute 'get'

From my understanding of the error and a quick google-fu, you just need sys.argv[1]. I modified the line to: config_file = sys.argv[1] if len(sys.argv) > 1 else 'config.ini' and now it works properly, using the entered config file

Posting this so if anyone else like me ends up with the error can make the module work, and if I am wrong I can be told where I am messing up!

Thanks

cyrils commented 8 months ago

Thanks, fixed it 👍