Skip to content

Commit

Permalink
Improved error handling reading autoProcess conf
Browse files Browse the repository at this point in the history
read() was being used which will not generate an error and cause a hard to understand crash later on when trying to read something from the configuration file. This could happen if the file existed, but the permission(s) weren't okay.
  • Loading branch information
SerhatG committed May 25, 2012
1 parent b3a7afe commit c3b5ac6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion autoProcessTV/autoProcessTV.py
Expand Up @@ -51,7 +51,13 @@ def processEpisode(dirName, nzbName=None):
print "ERROR: You need an autoProcessTV.cfg file - did you rename and edit the .sample?" print "ERROR: You need an autoProcessTV.cfg file - did you rename and edit the .sample?"
sys.exit(-1) sys.exit(-1)


config.read(configFilename) try:
fp = open(configFilename, "r")
config.readfp(fp)
fp.close()
except IOError, e:
print "Could not read configuration file: ", str(e)
sys.exit(1)


host = config.get("SickBeard", "host") host = config.get("SickBeard", "host")
port = config.get("SickBeard", "port") port = config.get("SickBeard", "port")
Expand Down

0 comments on commit c3b5ac6

Please sign in to comment.