Sperryfreak01 / RadarrSync

120 stars 47 forks source link

Running from directory other than the install dir results in error #15

Closed mrnoisytiger closed 5 years ago

mrnoisytiger commented 5 years ago

Describe the bug

When trying to run the script from any other directory, other than where the configuration file is, the script fails, because it can not find the config. This makes running from cron rather difficult.

To Reproduce

  1. Install the script and configure.

  2. Attempt to run script using absolute path away from the install directory. python3 /path/to/script.py

Expected behavior

Script runs.

Configuration

[Radarr]
url = http://127.0.0.1:7878
key = 7c6ef2bca5174f9c8ad203927b5766d1

[Radarr4k]
url = http://127.0.0.1:7879
key = 7c6ef2bca5174f9c8ad203927b5766d1
profile = 8

Logs

Traceback (most recent call last):
  File "/home/fjen/RadarrSync/RadarrSync.py", line 50, in <module>
    radarr_url = ConfigSectionMap("Radarr")['url']
  File "/home/fjen/RadarrSync/RadarrSync.py", line 28, in ConfigSectionMap
    options = Config.options(section)
  File "/usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py", line 671, in options
    raise from_none(NoSectionError(section))
backports.configparser.NoSectionError: No section: 'Radarr'
mrnoisytiger commented 5 years ago

Easily fixed by cd-Ing into the right directory in the cronjob.