PYTHONPATH is the environment variable that gets set that tells Python where to search for modules (.py files) when you do an "import modulename". When an "import" is done in Python, it looks through the module directories one-by-one within the ones specificed in PYTHONPATH. Zope does a lot of "import"s. As a matter of fact, the way it loads product modules is by "import"ing them. __init__.py is a file that tells Python that the current directory is a Python "package", meaning that you can do things like:
import PIL.Image
when "\Zope\lib\python\OFS" is in the PYTHONPATH and theres a directory named PIL inside "OFS" which contains an __init__.py. PIL isn't really a module, and generally when you try to "import PIL.Image", Python will try to find a file named "PIL.py" and an attribute (class, def, variablename) named "Image" (e.g. "class Image:") within that module. In our case, however, PIL is a directory and Image is a module. We need __init__.py to turn PIL into a "package", even though its totally blank. What is the traceback on the broken product? Dale Lance wrote:
Ok. deleted photo product. stopped zope. started zope. broken photo product :-(
BTW what is this PYTHONPATH env. variable and when/where was it supposed to get set?
Dale ----- Original Message ----- From: Chris McDonough <chrism@digicool.com> To: Dale Lance <d_lance@email.msn.com> Cc: <zope@zope.org> Sent: Sunday, January 09, 2000 6:40 PM Subject: Re: [Zope] Help with PIL / Photo product
Good!
OK, now start Zope and delete the Photo product by visiting the Product Management screen and deleting the product instance using the Zope maangement interface.
Then stop Zope and start it again.
Then see if you can use the product. It's still possible that the PYTHONPATH isn't right, so it may not work, but we're getting closer....
-------- Garbage collected ---------*
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org