summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/OCR.py
diff options
context:
space:
mode:
authorGravatar jansohn <jansohn@users.noreply.github.com> 2015-10-02 10:09:26 +0200
committerGravatar jansohn <jansohn@users.noreply.github.com> 2015-10-02 10:09:26 +0200
commit3a08656c5665f4b8db98744fb323e64b8630e084 (patch)
tree28f9f62ffc57888b76ca32540dbf5af3a4cfc8d0 /module/plugins/internal/OCR.py
parentMerge pull request #1 from pyload/stable (diff)
parent[Account] Improve parse_traffic method + code cosmetics (diff)
downloadpyload-3a08656c5665f4b8db98744fb323e64b8630e084.tar.xz
Merge pull request #2 from pyload/stable
sync with stable
Diffstat (limited to 'module/plugins/internal/OCR.py')
-rw-r--r--module/plugins/internal/OCR.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py
index b24b3058b..884639b6b 100644
--- a/module/plugins/internal/OCR.py
+++ b/module/plugins/internal/OCR.py
@@ -12,7 +12,6 @@ import logging
import os
import subprocess
# import tempfile
-import traceback
from module.plugins.internal.Plugin import Plugin
from module.utils import save_join as fs_join
@@ -95,7 +94,7 @@ class OCR(Plugin):
self.pyload.log_debug("Saving tiff...")
self.image.save(tmpTif.name, 'TIFF')
- if os.name == "nt":
+ if os.name is "nt":
tessparams = [os.path.join(pypath, "tesseract", "tesseract.exe")]
else:
tessparams = ["tesseract"]
@@ -128,6 +127,7 @@ class OCR(Plugin):
try:
with open(tmpTxt.name, 'r') as f:
self.result_captcha = f.read().replace("\n", "")
+
except Exception:
self.result_captcha = ""
@@ -137,10 +137,9 @@ class OCR(Plugin):
os.remove(tmpTxt.name)
if subset and (digits or lowercase or uppercase):
os.remove(tmpSub.name)
+
except OSError, e:
self.log_warning(e)
- if self.pyload.debug:
- traceback.print_exc()
def recognize(self, name):
@@ -194,6 +193,7 @@ class OCR(Plugin):
count += 1
if pixels[x, y - 1] != 255:
count += 1
+
except Exception:
pass