Solar-Helix-Independent-Transport / allianceauth-discordbot

allianceauth-discordbot
MIT License
6 stars 19 forks source link

PermissionError: [Errno 13] Permission denied: '[...]/log/discord_bot.log' #65

Closed sticker94 closed 2 years ago

sticker94 commented 2 years ago

Hello - Followed your installation guide and I've been having a few issues. I've sorted most of them, but I am now showing a 'missing' settings attribute. Can you provide context?

AttributeError: 'Settings' object has no attribute 'DISCORD_APP_ID'
Traceback (most recent call last):
  File "/home/insanehost/allianceserver/GALMIL/bot_conf.py", line 5, in <module>
    from aadiscordbot import launcher  # nopep8
  File "/home/insanehost/allianceserver/venv/auth/lib/python3.8/site-packages/aadiscordbot/launcher.py", line 8, in <module>
    from .bot import AuthBot
  File "/home/insanehost/allianceserver/venv/auth/lib/python3.8/site-packages/aadiscordbot/bot.py", line 34, in <module>
    INVITE_URL = f"https://discord.com/api/oauth2/authorize?client_id={settings.DISCORD_APP_ID}&permissions=8&scope=bot%20applications.commands"
  File "/home/insanehost/allianceserver/venv/auth/lib/python3.8/site-packages/django/conf/__init__.py", line 83, in __getattr__
soratidus999 commented 2 years ago

allianceauth-discordbot requires the Alliance Auth Discord Service to be installed and configured.

https://allianceauth.readthedocs.io/en/latest/features/services/discord.html

sticker94 commented 2 years ago

oh - my apologies. That was an old error.

My current error is this

Traceback (most recent call last):
  File "/usr/lib/python3.8/logging/config.py", line 563, in configure
    handler = self.configure_handler(handlers[name])
  File "/usr/lib/python3.8/logging/config.py", line 744, in configure_handler
    result = factory(**kwargs)
  File "/usr/lib/python3.8/logging/handlers.py", line 148, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python3.8/logging/handlers.py", line 55, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python3.8/logging/__init__.py", line 1147, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python3.8/logging/__init__.py", line 1176, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied: '/home/insanehost/allianceserver/GALMIL/log/discord_bot.log'

Traceback (most recent call last):
  File "/home/insanehost/allianceserver/GALMIL/bot_conf.py", line 14, in <module>
    main()
  File "/home/insanehost/allianceserver/GALMIL/bot_conf.py", line 10, in main
    launcher.run_bot()
  File "/home/insanehost/allianceserver/venv/auth/lib/python3.8/site-packages/aadiscordbot/launcher.py", line 15, in run_bot
    bot = AuthBot()
  File "/home/insanehost/allianceserver/venv/auth/lib/python3.8/site-packages/aadiscordbot/bot.py", line 51, in __init__
    django.setup()
  File "/home/insanehost/allianceserver/venv/auth/lib/python3.8/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/home/insanehost/allianceserver/venv/auth/lib/python3.8/site-packages/django/utils/log.py", line 75, in configure_logging
    logging_config_func(logging_settings)
  File "/usr/lib/python3.8/logging/config.py", line 808, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib/python3.8/logging/config.py", line 570, in configure
    raise ValueError('Unable to configure handler '
ValueError: Unable to configure handler 'bot_log_file'
sticker94 commented 2 years ago

Edit - re-ran the CHOWN command for allianceserver and all is well now.

As a fix to the guide:

The default conf file that is fetched using wget has an import that needs to be changed if the package was renamed from 'myauth'.