Re: [Zope] Help with PIL / Photo product
Again, sorry. I used the __init.py from Products/photo/install_PIL. I've actually never used anything else. So, as they say, the problem still persists. ----- Original Message ----- From: Gregor <vorlon@iglou.com> To: Dale Lance <d_lance@email.msn.com> Sent: Sunday, January 09, 2000 6:07 PM Subject: Re: [Zope] Help with PIL / Photo product
----- Original Message ----- From: "Dale Lance" <d_lance@email.msn.com> To: "Gregor" <vorlon@iglou.com> Sent: Sunday, January 09, 2000 6:56 PM Subject: Re: [Zope] Help with PIL / Photo product
Sorry, yes you are correct and that is the one I used.
The right one or the wrong one? ^_^
If the wrong one, did that fix it?
Dale, Delete your current PIL\__init__.py. Create a new PIL\__init__.py that has a single blank line in it using Notepad or something else and save it. When you've done that, go into DOS, and cd to the directory *above* the PIL directory (if you've followed my previous instructions, that would be "OFS") Then execute the command "python". This should start the Python interpreter. If it doesn't, find the python interpreter in the Zope tree somewhere (it's named "python"), and while you're still in the OFS directory, start it (e.g. ..\..\bin\python). Then type at the >>> prompt:
import PIL.Image
It should return no errors. If it does, we'll try again. Dale Lance wrote:
Again, sorry. I used the __init.py from Products/photo/install_PIL. I've actually never used anything else. So, as they say, the problem still persists.
----- Original Message ----- From: Gregor <vorlon@iglou.com> To: Dale Lance <d_lance@email.msn.com> Sent: Sunday, January 09, 2000 6:07 PM Subject: Re: [Zope] Help with PIL / Photo product
----- Original Message ----- From: "Dale Lance" <d_lance@email.msn.com> To: "Gregor" <vorlon@iglou.com> Sent: Sunday, January 09, 2000 6:56 PM Subject: Re: [Zope] Help with PIL / Photo product
Sorry, yes you are correct and that is the one I used.
The right one or the wrong one? ^_^
If the wrong one, did that fix it?
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
Ok Chris. I did it and had no errors. Dale ----- Original Message ----- From: Chris McDonough <chrism@digicool.com> To: Dale Lance <d_lance@email.msn.com> Cc: Gregor <vorlon@iglou.com>; <zope@zope.org> Sent: Sunday, January 09, 2000 6:27 PM Subject: Re: [Zope] Help with PIL / Photo product
Dale,
Delete your current PIL\__init__.py.
Create a new PIL\__init__.py that has a single blank line in it using Notepad or something else and save it.
When you've done that, go into DOS, and cd to the directory *above* the PIL directory (if you've followed my previous instructions, that would be "OFS")
Then execute the command "python". This should start the Python interpreter. If it doesn't, find the python interpreter in the Zope tree somewhere (it's named "python"), and while you're still in the OFS directory, start it (e.g. ..\..\bin\python).
Then type at the >>> prompt:
import PIL.Image
It should return no errors. If it does, we'll try again.
Dale Lance wrote:
Again, sorry. I used the __init.py from Products/photo/install_PIL. I've actually never used anything else. So, as they say, the problem still persists.
----- Original Message ----- From: Gregor <vorlon@iglou.com> To: Dale Lance <d_lance@email.msn.com> Sent: Sunday, January 09, 2000 6:07 PM Subject: Re: [Zope] Help with PIL / Photo product
----- Original Message ----- From: "Dale Lance" <d_lance@email.msn.com> To: "Gregor" <vorlon@iglou.com> Sent: Sunday, January 09, 2000 6:56 PM Subject: Re: [Zope] Help with PIL / Photo product
Sorry, yes you are correct and that is the one I used.
The right one or the wrong one? ^_^
If the wrong one, did that fix it?
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
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.... Dale Lance wrote:
Ok Chris. I did it and had no errors.
Dale ----- Original Message ----- From: Chris McDonough <chrism@digicool.com> To: Dale Lance <d_lance@email.msn.com> Cc: Gregor <vorlon@iglou.com>; <zope@zope.org> Sent: Sunday, January 09, 2000 6:27 PM Subject: Re: [Zope] Help with PIL / Photo product
Dale,
Delete your current PIL\__init__.py.
Create a new PIL\__init__.py that has a single blank line in it using Notepad or something else and save it.
When you've done that, go into DOS, and cd to the directory *above* the PIL directory (if you've followed my previous instructions, that would be "OFS")
Then execute the command "python". This should start the Python interpreter. If it doesn't, find the python interpreter in the Zope tree somewhere (it's named "python"), and while you're still in the OFS directory, start it (e.g. ..\..\bin\python).
Then type at the >>> prompt:
import PIL.Image
It should return no errors. If it does, we'll try again.
Dale Lance wrote:
Again, sorry. I used the __init.py from Products/photo/install_PIL. I've actually never used anything else. So, as they say, the problem still persists.
----- Original Message ----- From: Gregor <vorlon@iglou.com> To: Dale Lance <d_lance@email.msn.com> Sent: Sunday, January 09, 2000 6:07 PM Subject: Re: [Zope] Help with PIL / Photo product
----- Original Message ----- From: "Dale Lance" <d_lance@email.msn.com> To: "Gregor" <vorlon@iglou.com> Sent: Sunday, January 09, 2000 6:56 PM Subject: Re: [Zope] Help with PIL / Photo product
Sorry, yes you are correct and that is the one I used.
The right one or the wrong one? ^_^
If the wrong one, did that fix it?
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
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 ---------*
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
Thanks for the lesson. I understood it all. Was PYTHONPATH supposed to be part of the Zope install? I do a "set" from DOS and see no PYTHONPATH. I could modify start.bat to set one I guess. At any rate, the traceback is this Traceback (innermost last): File "C:\Program Files\WebSite\lib\python\OFS\Application.py", line 393, in import_products product=__import__(pname, global_dict, global_dict, silly) File "C:\Program Files\WebSite\lib\python\Products\Photo\__init__.py", line 42, in ? import Photo File "C:\Program Files\WebSite\lib\python\Products\Photo\Photo.py", line 56, in ? import PIL ImportError: No module named PIL Thanks for all this effort 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 7:13 PM Subject: Re: [Zope] Help with PIL / Photo product
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
No, it's set somewhere in the Zope startup... where, I'm not entirely certain :) And as I remember it, under Win32, I think it might even be read from a registry setting. Why don't we try this? Delete the "Photo" product in the Product Management screen. Move the whole PIL directory tree into C:\Program Files\WebSite\lib\python\Products\Photo (so you have a directory named C:\Program Files\WebSite\lib\python\Products\Photo\PIL that contains a blank __init__.py). Restart Zope. See if the product is still broken. Sorry I'm taking this in a "one-stab-at-a-time", I'm certain someone else could have solved this straight away, but my relative ignorance of That Which Is Win32 Python is hindering me here. Dale Lance wrote:
Thanks for the lesson. I understood it all. Was PYTHONPATH supposed to be part of the Zope install? I do a "set" from DOS and see no PYTHONPATH. I could modify start.bat to set one I guess.
At any rate, the traceback is this Traceback (innermost last): File "C:\Program Files\WebSite\lib\python\OFS\Application.py", line 393, in import_products product=__import__(pname, global_dict, global_dict, silly) File "C:\Program Files\WebSite\lib\python\Products\Photo\__init__.py", line 42, in ? import Photo File "C:\Program Files\WebSite\lib\python\Products\Photo\Photo.py", line 56, in ? import PIL ImportError: No module named PIL
Thanks for all this effort
Dale
<snippage> -- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
Yesssssss! Whew finally! But what does it mean? (Ignorance of the whole is definitely hobbling this horse) Now all I have to do is figure out how Photo product works! Thanks for the great effort. Really appreciated Dale Lance ----- 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 8:14 PM Subject: Re: [Zope] Help with PIL / Photo product
No, it's set somewhere in the Zope startup... where, I'm not entirely certain :) And as I remember it, under Win32, I think it might even be read from a registry setting.
Why don't we try this? Delete the "Photo" product in the Product Management screen. Move the whole PIL directory tree into C:\Program Files\WebSite\lib\python\Products\Photo (so you have a directory named C:\Program Files\WebSite\lib\python\Products\Photo\PIL that contains a blank __init__.py). Restart Zope. See if the product is still broken.
Sorry I'm taking this in a "one-stab-at-a-time", I'm certain someone else could have solved this straight away, but my relative ignorance of That Which Is Win32 Python is hindering me here.
Dale Lance wrote:
Thanks for the lesson. I understood it all. Was PYTHONPATH supposed to be part of the Zope install? I do a "set" from DOS and see no PYTHONPATH. I could modify start.bat to set one I guess.
At any rate, the traceback is this Traceback (innermost last): File "C:\Program Files\WebSite\lib\python\OFS\Application.py", line
393,
in import_products product=__import__(pname, global_dict, global_dict, silly) File "C:\Program Files\WebSite\lib\python\Products\Photo\__init__.py", line 42, in ? import Photo File "C:\Program Files\WebSite\lib\python\Products\Photo\Photo.py", line 56, in ? import PIL ImportError: No module named PIL
Thanks for all this effort
Dale
<snippage>
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
I'd need to go step through the code to see why this is happening (general ignorance on my part), but it means that the PYTHONPATH doesn't include OFS at the time when it imports the Photo product's module (which in turn imports PIL). PYTHONPATH, however, does include the Photo product's product directory (Products\Photo) at the time of import so it succeeds. Products\Photo may be Zope's current working directory when it gets imported, that would explain it. Might be something else entirely, though. Glad it's working, in any case. BTW, this actually helped me, because I'm working on a product that uses PIL and now I know a safe place to put it (I'm going to include the PIL files right along with the product if the license allows and Frederik Lundh says its OK) for both Windows and *NIX. Dale Lance wrote:
Yesssssss! Whew finally! But what does it mean? (Ignorance of the whole is definitely hobbling this horse)
Now all I have to do is figure out how Photo product works!
Thanks for the great effort. Really appreciated
Dale Lance
Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
In article <014a01bf5b16$c31b0800$4b0efea9@home>, Dale Lance <d_lance@email.msn.com> writes
Now all I have to do is figure out how Photo product works!
I've followed this discussion, and installed the Photo product with PIL in the Photo directory. However, when I add an instance of the Photo product, and try to upload a Gif image, I get the following traceback ( ntwks4 ) Error Type: AttributeError Error Value: Image Traceback (innermost last): File D:\zope2\lib\python\ZPublisher\Publish.py, line 214, in publish_module File D:\zope2\lib\python\ZPublisher\Publish.py, line 179, in publish File D:\zope2\lib\python\Zope\__init__.py, line 202, in zpublisher_exception_hook (Object: aphoto) File D:\zope2\lib\python\ZPublisher\Publish.py, line 165, in publish File D:\zope2\lib\python\ZPublisher\mapply.py, line 160, in mapply (Object: manage_upload) File D:\zope2\lib\python\ZPublisher\Publish.py, line 102, in call_object (Object: manage_upload) File D:\zope2\lib\python\OFS\Image.py, line 248, in manage_upload (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 242, in update_data (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 272, in _generateDisplays (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 282, in _generateDisplay (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 320, in resize AttributeError: (see above) ------- Regards, Graham Chiu gchiu<at>compkarori.co.nz http://www.compkarori.com/dynamo - The Homebuilt Dynamo http://www.compkarori.com/dbase - The dBase bulletin
Graham, What is in your __init__.py? Drew ----- Original Message ----- From: Graham Chiu <anon_emouse@hotmail.com> To: <zope@zope.org> Sent: Wednesday, January 12, 2000 5:45 AM Subject: Re: [Zope] Help with PIL / Photo product
In article <014a01bf5b16$c31b0800$4b0efea9@home>, Dale Lance <d_lance@email.msn.com> writes
Now all I have to do is figure out how Photo product works!
I've followed this discussion, and installed the Photo product with PIL in the Photo directory.
However, when I add an instance of the Photo product, and try to upload a Gif image, I get the following traceback ( ntwks4 )
Error Type: AttributeError Error Value: Image
Traceback (innermost last): File D:\zope2\lib\python\ZPublisher\Publish.py, line 214, in publish_module File D:\zope2\lib\python\ZPublisher\Publish.py, line 179, in publish File D:\zope2\lib\python\Zope\__init__.py, line 202, in zpublisher_exception_hook (Object: aphoto) File D:\zope2\lib\python\ZPublisher\Publish.py, line 165, in publish File D:\zope2\lib\python\ZPublisher\mapply.py, line 160, in mapply (Object: manage_upload) File D:\zope2\lib\python\ZPublisher\Publish.py, line 102, in call_object (Object: manage_upload) File D:\zope2\lib\python\OFS\Image.py, line 248, in manage_upload (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 242, in update_data (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 272, in _generateDisplays (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 282, in _generateDisplay (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 320, in resize AttributeError: (see above)
------- Regards, Graham Chiu gchiu<at>compkarori.co.nz http://www.compkarori.com/dynamo - The Homebuilt Dynamo http://www.compkarori.com/dbase - The dBase bulletin
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Graham, What is in your __init__.py? Drew ----- Original Message ----- From: Graham Chiu <anon_emouse@hotmail.com> To: <zope@zope.org> Sent: Wednesday, January 12, 2000 5:45 AM Subject: Re: [Zope] Help with PIL / Photo product
In article <014a01bf5b16$c31b0800$4b0efea9@home>, Dale Lance <d_lance@email.msn.com> writes
Now all I have to do is figure out how Photo product works!
I've followed this discussion, and installed the Photo product with PIL in the Photo directory.
However, when I add an instance of the Photo product, and try to upload a Gif image, I get the following traceback ( ntwks4 )
Error Type: AttributeError Error Value: Image
Traceback (innermost last): File D:\zope2\lib\python\ZPublisher\Publish.py, line 214, in publish_module File D:\zope2\lib\python\ZPublisher\Publish.py, line 179, in publish File D:\zope2\lib\python\Zope\__init__.py, line 202, in zpublisher_exception_hook (Object: aphoto) File D:\zope2\lib\python\ZPublisher\Publish.py, line 165, in publish File D:\zope2\lib\python\ZPublisher\mapply.py, line 160, in mapply (Object: manage_upload) File D:\zope2\lib\python\ZPublisher\Publish.py, line 102, in call_object (Object: manage_upload) File D:\zope2\lib\python\OFS\Image.py, line 248, in manage_upload (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 242, in update_data (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 272, in _generateDisplays (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 282, in _generateDisplay (Object: aphoto) File d:\zope2\lib\python\Products\Photo\Photo.py, line 320, in resize AttributeError: (see above)
------- Regards, Graham Chiu gchiu<at>compkarori.co.nz http://www.compkarori.com/dynamo - The Homebuilt Dynamo http://www.compkarori.com/dbase - The dBase bulletin
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
In article <01b301bf5d6a$d45f11a0$7dd907d0@aplsoftware>, Andrew Lahser <andrew@apl-software.com> writes
Graham,
What is in your __init__.py?
Drew
A blank line. ------- Regards, Graham Chiu gchiu<at>compkarori.co.nz http://www.compkarori.com/dynamo - The Homebuilt Dynamo http://www.compkarori.com/dbase - The dBase bulletin
participants (4)
-
Andrew Lahser -
Chris McDonough -
Dale Lance -
Graham Chiu