diff options
Diffstat (limited to 'module/plugins/captcha/captcha.py')
-rw-r--r-- | module/plugins/captcha/captcha.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py index 93c8164c6..e0cd7d31c 100644 --- a/module/plugins/captcha/captcha.py +++ b/module/plugins/captcha/captcha.py @@ -57,12 +57,17 @@ class OCR(object): def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True): #tmpTif = tempfile.NamedTemporaryFile(suffix=".tif") - tmpTif = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb") - tmpTif.close() - - #tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") - tmpTxt = open(join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb") - tmpTxt.close() + try: + tmpTif = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb") + tmpTif.close() + + #tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") + tmpTxt = open(join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb") + tmpTxt.close() + + except IOError, e: + self.logError(str(e)) + return self.logger.debug("save tiff") self.image.save(tmpTif.name, 'TIFF') |