From 5a458566991cc060c778c47100936284c342eae5 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sun, 18 Jun 2017 21:47:15 -0600 Subject: [PATCH] Pulled variable for subtitles path out of open() and retunes subfile without analysis on typeError. --- classedStray.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classedStray.py b/classedStray.py index 3b3fb8c..d3c846c 100755 --- a/classedStray.py +++ b/classedStray.py @@ -3,7 +3,7 @@ # @Author: KevinMidboe # @Date: 2017-04-05 18:40:11 # @Last Modified by: KevinMidboe -# @Last Modified time: 2017-06-01 19:02:04 +# @Last Modified time: 2017-06-18 21:45:42 import os.path, hashlib, time, glob, sqlite3, re, json, tweepy import logging from functools import reduce @@ -91,7 +91,11 @@ class strayEpisode(object): def analyseSubtitles(self, subFile): # TODO verify that it is a file - f = open(os.path.join([env.show_dir, self.parent, subFile]), 'r', encoding='ISO-8859-15') + try: + subtitlesPath = os.path.join([env.show_dir, self.parent, subFile]) + except TypeError: + return removeUploadSign(subFile) + f = open(subtitlesPath, 'r', encoding='ISO-8859-15') language = detect(f.read()) f.close()