- Name clashes (PIL vs Zope)...
Hi All, I'm writing a new Product which uses the Python Imaging Library to dynamically generate GIFs. I'm dying to see if it can be done by using StringIO's to store the image data so that no actual files will need to be written, but I've come across a snag... PIL and Zope both make use of the module names 'Image.py' and 'ImageFile.py'. I guess great minds do indeed think alike ;) My first instinct was to use sed to churn through the whole of PIL renaming all references to Image and ImageFile to pilImage and pilImageFile respectively. I'm wondering if there's a more elegant way of doing it? What's 'unzenlike' with this solution is that every time PIL or Zope gets updated, the whole process will have to be done again. Before I go delving in, does anyone know if creating a PIL 'package' could easily fix this, or is this going to be even more work than simply renaming the offending modules? Cheers, Andy.
written, but I've come across a snag... PIL and Zope both make use of the module names 'Image.py' and 'ImageFile.py'. I guess great minds do indeed think alike ;)
PythonWare has precedence of naming, not least because PIL was available prior to Python packages.
My first instinct was to use sed to churn through the whole of PIL renaming all references to Image and ImageFile to pilImage and pilImageFile respectively.
Ugh. There are certaintly better ways to do this. How about either having Zope permanently rename these to ZImage, ZImageFile or explicitly using the package-ized versions of these names throughout Zope? For OFS.Image, this should not be a problem, 'ImageFile' might have to be moved further down the hierarchy. ./lib/python/ImageFile.py ./lib/python/OFS/Image.py My preference would be to see Image, ImageFile renamed to remove all confusion, if it can be done without breaking existing applications. PIL is likely to be used a lot with Zope and renaming (rather than refactoring) is likely to cause fewer problems for people who use both products. Regards, Jeff Bauer Rubicon, Inc.
Hi Again, Thanks for the various replies I got to this! I've gone down the 'Packaging' route and this seems to have done the trick. I created a PIL directory in the python path, then inserted an __init__.py, which does nothing but import the required modules. So in the product I can now access PIL modules using PIL.Image and PIL.ImageFile etc. Maintaining an __init__.py file is certainly something I can live with. I think PIL and Zope can be put to good use with each other .. storing the GIF using a StringIO instead of a file worked fine, so it'll be possible to generate GIFs on the fly without them having to have ever existed on the filesystem... nice! Cheers again, Andy.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Andy Smith Sent: Thursday, January 28, 1999 10:02 PM To: Zope; fredrik@pythonware.com Subject: [Zope] - Name clashes (PIL vs Zope)...
Hi All,
I'm writing a new Product which uses the Python Imaging Library to dynamically generate GIFs. I'm dying to see if it can be done by using StringIO's to store the image data so that no actual files will need to be written, but I've come across a snag... PIL and Zope both make use of the module names 'Image.py' and 'ImageFile.py'. I guess great minds do indeed think alike ;)
My first instinct was to use sed to churn through the whole of PIL renaming all references to Image and ImageFile to pilImage and pilImageFile respectively. I'm wondering if there's a more elegant way of doing it? What's 'unzenlike' with this solution is that every time PIL or Zope gets updated, the whole process will have to be done again.
Before I go delving in, does anyone know if creating a PIL 'package' could easily fix this, or is this going to be even more work than simply renaming the offending modules?
Cheers,
Andy.
_______________________________________________ Zope maillist - Zope@zope.org http://www2.zope.org/mailman/listinfo/zope
participants (3)
-
Andy Smith -
Andy Smith -
Jeff Bauer