开发者

<type 'exceptions.ImportError'>: cannot import name service_handlers

开发者 https://www.devze.com 2023-03-13 13:59 出处:网络
I built a web app a month ago and then tested it. It had been working fine during last month without any code modifications but suddenly today I saw there an error occurring permanently.

I built a web app a month ago and then tested it. It had been working fine during last month without any code modifications but suddenly today I saw there an error occurring permanently.

<type 'exceptions.ImportError'>: cannot import name service_handlers
Traceback (most recent call last):
  File "/base/data/home/apps/infinillaapp/1.351169771270370877/services.py", line 10, in <module>
    from protorpc import service_handlers

I tried to import the module different ways but nothing helped. So, I su开发者_Go百科ppose there is something wrong with the GAE environment? Also, it works fine as before on the local machine. Did anybody face such unexpected module import problems with GAE?


This is a bit of a guess; but I think protorpc is going to be included in AppEngine 1.5.1, maybe they have added it in the background somewhere and it's conflicting.

Try adding the protorpc path to the beginging of sys.path:

sys.path = ['protorpc'] + sys.path

Also, try updating protorpc to the latest version to see if you get the error locally as much of the GAE specific code has moved. The new import should be:

from protorpc.webapp import service_handlers


Chris is right - the service_handlers file has moved to the webapp module. You can just use

from protorpc.webapp import service_handlers


If you need to depend on your own private version you can also set up your pythonpath to make it so.

0

精彩评论

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