From 8597abf1b8320327aab5cbc0ecd0dbf78f2ae945 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sat, 5 Sep 2009 21:13:46 +0200 Subject: cat replacement --- module/captcha/captcha.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/captcha/captcha.py') diff --git a/module/captcha/captcha.py b/module/captcha/captcha.py index ffb165dbf..283b171e0 100644 --- a/module/captcha/captcha.py +++ b/module/captcha/captcha.py @@ -17,6 +17,7 @@ # along with this program; if not, see . # ### +from __future__ import with_statement import logging import subprocess import tempfile @@ -90,8 +91,10 @@ class OCR(object): self.image.save(tmp.name, 'TIFF') self.logger.debug("run tesseract") self.run(['tesseract', tmp.name, tmpTxt.name.replace(".txt", "")]) - self.logger.debug("run cat") - self.result_captcha = self.run(['cat', tmpTxt.name]).replace("\n", "") + self.logger.debug("read txt") + + with open(tmpTxt.name, 'r') as f: + self.result_captcha = f.read().replace("\n", "") def get_captcha(self): raise NotImplementedError -- cgit v1.2.3