From: mcl on
My Code

`import os
from PIL import Image
from iptcinfo import IPTCInfo
info = IPTCInfo('test.jpg')
print info.keywords, info.supplementalCategories, info.contacts
caption = info.data['caption/abstract']
print caption`

running Win XP SP3

I get the message

No module: iptcinfo

I have downloaded iptcinfo and placed it in python27\Lib\site-packages
\iptcinfo

I guessed that was the right place, because that is where PIL ended
up, but that had a fancy installer with it.

As you will appreciate, I am very much an amateur in all this. I can
code a bit of python, but where everything goes and links is a
complete mystery. All I want is to write a quick script which
extracts the Caption field from a directory of JPEGS. I get the
filenames and the dimensions with PIL, but I need IPTCinfo to get at
the Caption field.

If anyone can throw any light on what I need to do or which stupid
mistake I have made, I would be most grateful.

Richard

From: mcl on
On Jul 12, 4:11 pm, Nick Raptis <airsc...(a)otenet.gr> wrote:
> Hi Richard!> I have downloaded iptcinfo and placed it in python27\Lib\site-packages
> > \iptcinfo
>
> > I guessed that was the right place, because that is where PIL ended
> > up, but that had a fancy installer with it.
>
> You did place it in the right path, but the "fancy installer" does one
> more thing, it registers the package into the python-path, so python can
> get to it.
> I've long switched from windows unfortunately and can't remember the way
> it does this though, so you can do it manually.
>
> Have some good news though: I looked in the IPTCinfo package and it does
> indeed include a setup.py, which is a standard way of installing python
> packages.
> All you need to do is unpack the package to any folder and run
> setup.py install
> from that folder, which should take care of everything for you.
>
> Some documentation on installing packages for you to read:http://docs.python.org/install/
>
> Nick

What a star. It is all now working.

I will try to look at the reference you mentioned, but at the moment I
can not even figure out why 'python' on its own does not work. I
would have thought the installation would have set the appropriate
environment variables, but it does not seem to have. I have to give
the full path name to python.exe. Just remembered SET at DOS prompt,
but no mention of PYTHON anywhere.

Thank you very much again - I now have a list of all my JPEGS and
their CAPTIONS.

Richard