How to import Image and ImageDraw libraries from PIL to google apps

757 views
Skip to first unread message

chinki

unread,
Jun 17, 2009, 6:01:44 AM6/17/09
to Google App Engine
Hi,

Issue is : getting this error
<type 'exceptions.ImportError'>: No module named PIL
args = ('No module named PIL',)
message = 'No module named PIL'
when tried to call the statement import PIL

I just want to create an image file dynamically. The things I have
done for this is

1. Installed PIL for python 2.5 under the directory Python25\Lib\site-
packages.
2.Tried to call these import statements

from google.appengine.api import images

then getting the error is
<type 'exceptions.NameError'>: global name 'Image'
is not defined
args = ("global name 'Image' is not defined",)
message = "global name 'Image' is not defined"


3. Again I tried this
import PIL
from PIL import Image
after copying the PIL directory from Lib\site-packages to api
directory "google_appengine\google\appengine\api".


Please any one tell me how to import the Image and ImageDraw from
PIL . Is there any sample application in GAE for creating an image
dynamically? Please respond.

Thanks in Advance.

Nick Johnson (Google)

unread,
Jun 17, 2009, 12:02:15 PM6/17/09
to google-a...@googlegroups.com
Hi chinki,

It's not possible to use Python modules that require extension modules (C code) in App Engine. This includes the PIL library. The Image API is available, which may meet your needs: http://code.google.com/appengine/docs/python/images/ . If not, you will need to use an external service to achieve this.

-Nick Johnson
--
Nick Johnson, App Engine Developer Programs Engineer
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047
Reply all
Reply to author
Forward
0 new messages