开发者

Problem getting to work with images in google app engine in development server

* 1. Download the Windows installer from the PIL website.
* 2. Double click on the installer to start the installation process.
* 3. Choose the correct directory for PIL install.
* 4. Finish the installation and test out our sample application locally.

These are instructions from google website. but what is the "Choose the correct directory for PIL install." correct directory? is in the python lib? in the google app engine? or somewhere else?

I can't get to work with images locally:

my code:

def upload(input):

items = input['items']开发者_如何学编程

for item in items:
    img = images.resize(item['image'], 300, 300)


return img

I've installed the PIL in the c:\python dir and then I copyed the folder in my project root. still doesnt work! :s

the error I got is:

"D:\Totty\webDevelopment\TottysWorld\src\app\services\images\upload.py", line 11, in upload img = images.resize(item['image'], 300, 300) , File "C:\GAE\google\appengine\api\images_init_.py", line 633, in resize return image.execute_transforms(output_encoding=output_encoding) , File "C:\GAE\google\appengine\api\images_init_.py", line 521, in execute_transforms response) , File "C:\GAE\google\appengine\api\apiproxy_stub_map.py", line 78, in MakeSyncCall return apiproxy.MakeSyncCall(service, call, request, response) , File "C:\GAE\google\appengine\api\apiproxy_stub_map.py", line 278, in MakeSyncCall rpc.CheckSuccess() , File "C:\GAE\google\appengine\api\apiproxy_rpc.py", line 149, in _WaitImpl self.request, self.response) , File "C:\GAE\google\appengine\api\apiproxy_stub.py", line 80, in MakeSyncCall method(request, response) , File "C:\GAE\google\appengine\api\images\images_stub.py", line 196, in _Dynamic_Transform response_value = self._EncodeImage(new_image, request.output()) , File "C:\GAE\google\appengine\api\images\images_stub.py", line 227, in _EncodeImage image.save(image_string, image_encoding) , File "C:\Python25\Lib\site-packages\PIL\Image.py", line 1439, in save , File "C:\Python25\Lib\site-packages\PIL\PngImagePlugin.py", line 564, in _save ,SystemError: Parent module 'PIL' not loaded


PIL must be installed into the Python installation path. Let's say you've installed Python 2.5 to C:\Python, then installation path for PIL should be 'C:\Python\Lib\site-packages\'.

Also you don't have to copy PIL directory to project root when you install it right into the python directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜