Strange, I just gotten PIL here (through easy-install) and from PIL
import Image didn't work even in the command line... what worked was
'import Image' directly -- after investigating a bit, it seems
easy_install did the wrong thing (it created a
site-packages/PIL-1.1.7-py2.6-win32.egg, but inside that directory
there was no PIL/__init__.py, but the Image.py file directly), so, I
changed to the structure below and it seems to be working properly
now.

The way I'd expect it to be is:

/usr/lib/python2.7/dist-packages/ <-- added to the PYTHONPATH
/usr/lib/python2.7/dist-packages/PIL <- directory with PIL
/usr/lib/python2.7/dist-packages/PIL/__init__.py <-- specify that PIL
is a package
/usr/lib/python2.7/dist-packages/PIL/Image.py <-- Image module

Can you check if your config is like that?

Also, I noted you said you added /usr/lib/python2.7/dist-packages/PIL
to the PYTHONPATH, but that seems strange... if you actually have
/usr/lib/python2.7/dist-packages/PIL/__init__.py, the directory that
should be in the PYTHONPATH would be /usr/lib/python2.7/dist-packages
(unless the actual PIL is at:
/usr/lib/python2.7/dist-packages/PIL/PIL/__init__.py).

Cheers,

Fabio

On Mon, Oct 3, 2011 at 12:16 PM, John Smith <bitnu...@yahoo.com> wrote:
> Hi there,
> I'm using Eclipse 3.7 (Indigo) and pyDev 2.2.2.2011082312 on Ubuntu 11.04.
> When I run the following code...
> [code]
> from PIL import Image
> im = Image.open("download.png")
> im.rotate(45).show()[/code]
>
> It works fine on my command line python interpreter 2.7.1+. However when I
> enter this code in a blank form on Eclipse I get the "Image" part of the
> first line underlined in red and Eclipse says "Unresolved Import". Eclipse
> will still run the code fine because I'm using the same 2.7.1+ interpreter
> through Eclipse. It seems like it's an issue of Eclipse not finding the PIL
> package. I tried going to Preferences->PyDev->Interpreter-Python-> and
> deleting and recreating it but that did not work. Also the
> /usr/lib/python2.7/dist-packages/PIL is in the System PYTHONPATH in Eclipse.
> What am I doing wrong?
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> pydev-code mailing list
> pydev-code@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pydev-code
>
>

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
pydev-code mailing list
pydev-code@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pydev-code

Reply via email to