Dunno if it counts as funny, but the following code only works if you keep the matplotlib import:
import matplotlib
import PIL
im = PIL.Image.open("foo.png") import matplotlib
import PIL
im = PIL.Image.open("foo.png") import PIL.Image
Turns out that matplotlib (and probably lots of other stuff) does that, and then it gets resolved correctly.