From 15c367ffb499daab3cdf9dace618bd484bc38103 Mon Sep 17 00:00:00 2001 From: Mathieu Mitchell Date: Fri, 23 Nov 2012 11:48:24 -0500 Subject: [PATCH] Workaround for PIL's ambiguious import method and/or easy_install PIL packaging problem. PIL documents two different way to import it's modules: * import Image (http://www.pythonware.com/library/pil/handbook/introduction.htm) * from PIL import Image (http://www.pythonware.com/library/pil/handbook/image.htm) The same problem was noted in Django at https://code.djangoproject.com/ticket/6054 --- libmproxy/console/contentview.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libmproxy/console/contentview.py b/libmproxy/console/contentview.py index 1e9b9160f..2e93727a9 100644 --- a/libmproxy/console/contentview.py +++ b/libmproxy/console/contentview.py @@ -1,7 +1,12 @@ import re, cStringIO, traceback, json import urwid -from PIL import Image -from PIL.ExifTags import TAGS + +try: from PIL import Image +except ImportError: import Image + +try: from PIL.ExifTags import TAGS +except ImportError: from ExifTags import TAGS + import lxml.html, lxml.etree import netlib.utils import common