DMcP89 / harambot

A Yahoo Fantasy Sports bot for Discord
MIT License
29 stars 18 forks source link

Add check for setting.LOGLEVEL to models.py #157

Closed DMcP89 closed 2 months ago

DMcP89 commented 2 months ago

https://github.com/DMcP89/harambot/blob/main/harambot/database/models.py#L11

Add a check like this:

if "LOGLEVEL" in settings:
    logger.setLevel(settings.LOGLEVEL)
else:
    logger.setLevel("DEBUG")
captbrando commented 2 months ago

Another error popped up during execution:

Task exception was never retrieved future: <Task finished name='Task-17' coro=<WebServer.webserver() done, defined at /usr/local/lib/python3.10/site-packages/harambot/cogs/webserver.py:18> exception=AttributeError("'Settings' object has no attribute 'PORT'")> Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/harambot/cogs/webserver.py", line 33, in webserver site = web.TCPSite(runner, "0.0.0.0", settings.port) File "/usr/local/lib/python3.10/site-packages/dynaconf/base.py", line 145, in __getattr__ value = getattr(self._wrapped, name) File "/usr/local/lib/python3.10/site-packages/dynaconf/base.py", line 328, in __getattribute__ return super().__getattribute__(name) AttributeError: 'Settings' object has no attribute 'PORT'

It does look like the bot is running. A bit slowly in the Docker instance. May try straight up Python here in a second to see if that helps.

captbrando commented 2 months ago

SCR-20240827-oepa

Some examples of what I see.

DMcP89 commented 2 months ago

This looks like another scenario where I've missed a settings check, PORT is used by the webserver cog that provides a health endpoint for the bot

captbrando commented 2 months ago

Found another one:

AttributeError: 'Settings' object has no attribute 'WEBHOOK_AVATAR_URL'

captbrando commented 2 months ago

As it turns out, a pip install does not create the config folder or its contents. That would be the issue.

DMcP89 commented 2 months ago

Resolved by #161

Config files will be phased out in future release in favor of environment variables