From a11b4d01a8d3d77fae89914fb0950d5fbb3b86b1 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sat, 21 Aug 2010 13:18:58 +0200 Subject: adaptions for win build --- module/plugins/Plugin.py | 8 +++++--- module/plugins/captcha/captcha.py | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 210b1b7ff..31aae2ee9 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -29,6 +29,7 @@ from random import randint import sys from os.path import exists +from os import remove from os import makedirs from tempfile import NamedTemporaryFile @@ -203,10 +204,10 @@ class Plugin(object): content = self.load(url, get=get, post=post, cookies=cookies) temp = NamedTemporaryFile() + temp = open("tmpCaptcha_%s" % self.__name__, "wb") - f = temp.file - f.write(content) - f.flush() + temp.write(content) + temp.close() Ocr = self.core.pluginManager.getCaptchaPlugin(self.__name__) @@ -232,6 +233,7 @@ class Plugin(object): result = task.getResult() task.removeTask() + remove(temp.name) #temp.unlink(temp.name) return result diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py index 51021e8a5..b4a6b0a37 100644 --- a/module/plugins/captcha/captcha.py +++ b/module/plugins/captcha/captcha.py @@ -26,6 +26,10 @@ import tempfile import threading import Image +import TiffImagePlugin +import PngImagePlugin +import GifImagePlugin +import JpegImagePlugin class RunThread(threading.Thread): def __init__(self): -- cgit v1.2.3