在开发服务器中使用谷歌应用引擎中的图像时遇到问题

时间:2010-10-26 22:01:26

标签: google-app-engine

* 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.

这些是来自Google网站的说明。 但是什么是“为PIL安装选择正确的目录”。正确的目录? 在python lib中?在谷歌应用程序引擎?或其他地方?

我无法在本地处理图片:

我的代码:

def upload(input):

items = input['items']

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


return img

我已经在c:\ python目录中安装了PIL,然后在项目根目录中复制了该文件夹。还是不行! :■

我得到的错误是:

“D:\ Totty \ webDevelopment \ TottysWorld \ src \ app \ services \ images \ upload.py”,第11行,上传     img = images.resize(item ['image'],300,300) ,文件“C:\ GAE \ google \ appengine \ api \ images_ init _。py”,第633行,调整大小     return image.execute_transforms(output_encoding = output_encoding) ,文件“C:\ GAE \ google \ appengine \ api \ images_ init _。py”,第521行,在execute_transforms中     响应) ,文件“C:\ GAE \ google \ appengine \ api \ apiproxy_stub_map.py”,第78行,在MakeSyncCall中     return apiproxy.MakeSyncCall(服务,电话,请求,响应) ,MakeSyncCall中的文件“C:\ GAE \ google \ appengine \ api \ apiproxy_stub_map.py”,第278行     rpc.CheckSuccess() ,文件“C:\ GAE \ google \ appengine \ api \ apiproxy_rpc.py”,第149行,在_WaitImpl中     self.request,self.response) ,MakeSyncCall中的文件“C:\ GAE \ google \ appengine \ api \ apiproxy_stub.py”,第80行     方法(请求,响应) ,文件“C:\ GAE \ google \ appengine \ api \ images \ images_stub.py”,第196行,在_Dynamic_Transform中     response_value = self._EncodeImage(new_image,request.output()) ,文件“C:\ GAE \ google \ appengine \ api \ images \ images_stub.py”,第227行,在_EncodeImage中     image.save(image_string,image_encoding) ,文件“C:\ Python25 \ Lib \ site-packages \ PIL \ Image.py”,第1439行,保存 ,文件“C:\ Python25 \ Lib \ site-packages \ PIL \ PngImagePlugin.py”,第564行,在_save中 ,SystemError:未加载父模块'PIL'

1 个答案:

答案 0 :(得分:2)

必须将PIL安装到Python安装路径中。假设你已经将Python 2.5安装到C:\ Python,那么PIL的安装路径应该是'C:\ Python \ Lib \ site-packages \'。

当您将PIL目录安装到python目录中时,也不必将PIL目录复制到项目根目录。