﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21355	Try importing _imaging from PIL namespace first.	Richard Xia	Anssi Kääriäinen	"Patch available at https://github.com/django/django/pull/1819. Fixes problem described in #20964.

On an OS X system with a Homebrew version of Python/PIL installed, the django/utils/image module encounters a hash collision error when trying to import _imaging, as described in #20964. Although that ticket was closed for not being a problem with Django, the ticket it references in the Homebrew project (https://github.com/mxcl/homebrew/issues/22135) only resulted in removing PIL from the core Homebrew libraries without actually fixing the original import issue. Everyone in the Homebrew ticket discussion agrees that pillow should be used in place of PIL, but because Django isn't officially removing support for PIL until 1.8, I believe that this problem deserves to be fixed in time for 1.6.

In my patch, I attempt to import _imaging from the PIL namespace first, which prevents the hash collision error because the _imaging module will imported using the same filesystem path as when imported through the earlier {{{ from PIL import Image }}} statement. If _imaging isn't available under PIL, then it attempts to import _imaging directly just as did before. This allows PIL to be properly imported in my setup (OS X 10.8, Homebrew Python/PIL) and should still be compatible with environments in which the PIL namespace isn't available."	Bug	closed	Utilities	1.6	Release blocker	fixed	pil pillow	preston@…	Accepted	1	0	0	0	0	0
