I have installed the Python Imaging Library. But i am not able to use it. When I run the script in windows it says
"ImportError: No module named ImageGrab"

I also created the PATH VARIABLE called PYTHONPATH and gave the location of the installed modules.

Please help.

how do you import it?
What OS do you have?

how do you import it?
What OS do you have?

I am using windows xp. i am inporting like this

import ImageGrab

Try ...
from PIL import ImageGrab

Try ...
from PIL import ImageGrab

Now it says
ImportError: No module named PIL

Try opening up a python command line, and enter the folowing:
help()
modules

After a short while you should see a list of all installed modules.

Does PIL appear anywhere in the list??
If you can't see it, you should try running the PIL installer again.
But if it is there, I'm not sure what to suggest....

Just a thought, which version/s of python do you have installed?
If you've got more than one version of python installed, have you installed PIL for a different version of python?

For example, I've got 5 versions of Python (2.4, 2.5, 2.6, 3.0 and 3.1) installed on my work PC, but I've only got PIL installed for python 2.6.

So as long as I'm using Idle2.6 or the python 2.6 shell, PIL is available to me. But if I'm using any of the other versions of python, it is unavailable to me... Not sure if that could be your problem...

Other than that I'm pretty much out of ideas!
Cheers for now,
Jas.

If you installed the Python Image Library (PIL) properly, there should be a directory like
C:\Python26\Lib\site-packages\PIL
on your computer. If not, your installation went wrong.

That assumes that you have Python26 and downloaded and executed file
PIL-1.1.6.win32-py2.6.exe

Then re install the module.
I haven't used PIL but does it go with capita letters PIL or small one?
Try from pil import ....

I have only python 2.5 installed and i can find PIL in the Pythons installation directory. I use a IDE called PyScripter. When i run the program from the IDE it works fine. But it throws error when i run it from the command line.

I have only python 2.5 installed and i can find PIL in the Pythons installation directory. I use a IDE called PyScripter. When i run the program from the IDE it works fine. But it throws error when i run it from the command line.

What do you mean with run it from the command line? What is your command?

If the name of my script is lets say "lcd.py", at the command prompt i use
python lcd.py

PIL is not part of Standard Library. Did you install it explicitly?

PIL is not part of Standard Library. Did you install it explicitly?

Yes. I did.

Yes. I did.

Thanks for your help guys. I was able to solve it by adding a env variable by name PYTHONPATH and pointing this to the PIL module.

Is that Linux?
I guess the module installed in non standard path and needed to add .pth file to point to that folder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.