[Image-SIG] Question about ImageDraw.Draw function
Chris Cogdon
chris at cogdon.org
Tue Aug 26 15:34:07 EDT 2003
On Tuesday 26 August 2003 12:04, Mark Shure wrote:
> Hello,
>
> I'm a relative newcomer to Python and PIL, but I've been using it
successfully for several months. I was stumped by the error I got when I
tried using the ImageDraw.Draw(im) function. Here is what I see when I run
example code straight out of the PIL 1.1.3 Overview document:
> >>> import Image, ImageDraw
> >>> im = Image.open("lena.ppm")
> >>> draw = ImageDraw.Draw(im)
>
> Traceback (most recent call last):
> File "C:/Python22/imageDraw_test2.py", line 3, in ?
> draw = ImageDraw.Draw(im)
> File "C:\Python22\lib\site-packages\PIL\ImageDraw.py", line 72, in
> __init__ self.draw = Image.core.draw(self.im, blend)
> AttributeError: 'module' object has no attribute 'draw'
>
> I'm using Python 2.2.1 under Win2k with PIL 1.1.4 (binaries installed using
> "PIL-1.1.4.win32-py2.2.exe").
>
> I haven't been able to find any leads on the web or in the Image-SIG
> mailing list archive. Any suggestions would be appreciated.
This isn't complete help, but it might give you some pointers:
- The sequence of instructions above works just fine on my system (linux)
In Image.py, there's a statement that says:
core = _imaging
(There's code in there to put something else in place if _imaging is missing.
However, since the error above refers to 'module', it means that it IS in
fact a module)
So... the 'draw' attribute actually comes from _imaging, which is the
written-in-C module that gets installed along with the rest of the python
modules.
If you're seeing the error you are, it means that the module IS there, but for
some reason is missing the 'draw' method. Looking at the C code there doesn't
seem to be any reason that _imaging would be there, but the draw method would
not. It's totally weird
--
("`-/")_.-'"``-._ Chris Cogdon <chris at cogdon.org>
. . `; -._ )-;-,_`)
(v_,)' _ )`-.\ ``-'
_.- _..-_/ / ((.'
((,.-' ((,/ fL
More information about the Image-SIG
mailing list