Permalink
Browse files

Improved error handling reading autoProcess conf

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...
1 parent b3a7afe commit c3b5ac687f0decc119d36e79a06f1b229c75387d @SerhatG SerhatG committed May 25, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 autoProcessTV/autoProcessTV.py
@@ -51,7 +51,13 @@ def processEpisode(dirName, nzbName=None):
print "ERROR: You need an autoProcessTV.cfg file - did you rename and edit the .sample?"
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")
port = config.get("SickBeard", "port")

0 comments on commit c3b5ac6

Please sign in to comment.