fix no config file handling

This commit is contained in:
array-in-a-matrix 2023-06-12 10:33:48 -04:00
parent 718627ad2e
commit a3720ce3bf

15
main.py
View file

@ -51,14 +51,19 @@ async def main() -> None:
try:
with open('texlily.yaml', 'r') as conf:
config = yaml.safe_load(conf)
# if config file does not exist, quit
except FileNotFoundError:
print("No config file found.\nPlease create a file named `texlily.yaml` and read the README file.")
quit()
# Retrieve our configuration.
homeserver = str(config["homeserver"])
user = str(config["user"])
token = str(config["token"])
path = str(config["path"])
try:
# Retrieve our configuration
homeserver = str(config["homeserver"])
user = str(config["user"])
token = str(config["token"])
# path = str(config["path"]) # not used
except TypeError:
print("Invalid configuration file.")
quit()
client = AsyncClient(homeserver)
client.access_token = token