部署和调试都遇到问题,受挫

2011-11-01 11:01:20 +08:00
 linsk
GoogleAppEngineLuancher 开着iSSH
不连VPN遇到urllib2.URLError: <urlopen error (60, 'Operation timed out')>
一开VPN直接验证失败。

调试也遇到好多问题。
用Macports装了PIL
在terminal里找到了..
>>> import PIL
>>> PIL
<module 'PIL' from '/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/__init__.pyc'>

python2.5 -c "from PIL import Image" 也没出现任何错误提醒。

但在GAE Luancher调试报错,
raise NotImplementedError("Unable to find the Python PIL library. Please "
NotImplementedError: Unable to find the Python PIL library. Please view the SDK documentation for details about installing PIL on your system.


这到底是怎么会是呀。求救...
GAEluancher是最新版本
4388 次点击
所在节点    Google App Engine
4 条回复
linsk
2011-11-01 11:33:50 +08:00
@keakon 亲 麻烦看一下
keakon
2011-11-01 11:41:45 +08:00
@linsk 你应该直接使用google.appengine.api.images

如果非要用PIL的话,只有Python 2.7支持,不过没法本地调试
需要在app.yaml里加上
libraries:
- name: PIL
version: latest
linsk
2011-11-01 17:50:46 +08:00
@keakon 谢谢你。

是直接用google.appengine.api.images,本地调试以来PIL。
部署不上去才头疼.
keakon
2011-11-01 20:38:04 +08:00
@linsk 我刚试了下,没遇到什么问题

先是下载PIL的源码,下载下来后执行这个安装:
sudo python setup.py install

看到安装的位置是:
/Library/Python/2.7/site-packages/PIL/

我的Mac上有安装2.6和2.7这2个版本,默认是用2.7。


接着打开GoogleAppEngineLuancher,在设置里改下Python的路径:
/usr/bin/python
不改的话就会用2.6版


然后再测试一下,无异常:
class MainHandler(webapp.RequestHandler):
def get(self):
f = open('demo.png', 'rb')
img = f.read()
img = images.resize(img, 32, 32)
self.response.headers['Content-Type'] = 'image/png'
self.response.out.write(img)

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/20518

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX