GAE's webapp2_extra.i18n can't import babel on MacOSX

萝らか妹 提交于 2019-12-11 04:18:53

问题


I followed the tutorial to enable i18n functionality in my GAE project:

http://webapp-improved.appspot.com/tutorials/i18n.html

However, after I easy_install the babel, I can't access my GAE due to the error:

File "/Users/myname/Developer/GAE/project/webapp2_extras/i18n.py", line 16, in <module>
    import babel
ImportError: No module named babel

And I tried to load it in my cmdline:

 $ python2.7
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import babel
>>> 

It works fine!

I suspect the problem is that GAE can't load the library, but I don't know how to solve it.

Please help, thanks!

My working environment is MaxOSX Lion, Python2.7, GAE 1.6.6.


回答1:


The doc states

For App Engine, download babel and pytz and add those libraries to your app directory.

That means you have to copy them into the app directory, not easy_install, as the SDK has import restrictions to emulate the production environment.



来源:https://stackoverflow.com/questions/10898491/gaes-webapp2-extra-i18n-cant-import-babel-on-macosx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!