由于导入_multiprocessing导致的app-engine错误

时间:2013-03-26 00:05:51

标签: google-app-engine python-2.7 multiprocessing google-cloud-endpoints

我创建了一个app-engine端点api,我使用GoogleAppengineLauncher加载它。 api发布很好。但是当我尝试加载api explorer进行测试时,由于行from multiprocessing import Process而出现错误。我的研究让我to this site。但那不适合我。有谁知道如何解决这个问题?

from multiprocessing import Process
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/__init__.py", line 84, in <module>
    import _multiprocessing
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 861, in load_module
    raise ImportError
ImportError
INFO     2013-03-25 23:46:32,229 server.py:528] "POST /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 500 -
INFO     2013-03-25 23:46:32,229 server.py:528] "GET /_ah/api/discovery/v1/apis HTTP/1.1" 500 60

1 个答案:

答案 0 :(得分:1)

在这个group thread中,Python 2.7 App Engine运行时工程师之一指出应该使用新的Python 2.7 futures的备选方案(即threading support包)。

或者,您可以使用fetch_data_async函数从blob中读取而不会阻塞。

fetch_data_rpc = blobstore.fetch_data_async(...)
other_processing()
upload_url = fetch_data_rpc.get_result()