abcminiuser / python-homeassistant-streamdeck

Python client to control a HomeAssistant instance using an Elgato Stream Deck controller.
46 stars 7 forks source link

Example config file throws error #5

Closed Br3nda closed 4 years ago

Br3nda commented 5 years ago
$ ./src/HassClient.py 
INFO:root:Reading config file "config.yaml"...
ERROR:root:Failed to read config file "config.yaml"!
Traceback (most recent call last):
  File "./src/HassClient.py", line 130, in <module>
    if config.get('debug'):
  File "./src/HassClient.py", line 36, in get
    location = location.get(fragment, None)
AttributeError: 'list' object has no attribute 'get'
abcminiuser commented 5 years ago

Thanks for the report! I've fixed the errors returned when the config file is missing in 727f2147a9742c6acfd0b0a7aa020efa2e58f8a5 (it will now give a slightly more useful error about missing entries).

That said, the root cause of your issue seems to be running the script from a different working directory - you will need to cd in the src folder before running it to get the example config to load.

I intentionally made the config and assets load relative to the current working directory rather than the absolute path of the main script, as this way you can drop your config and assets into a different folder of your filesystem, and run the script from that directory to load them without having to modify the files in this Git repo.