问题
EDIT: I just gave it a go on appengine itself and it seems like it actually works there, so the problem is just with the dev server. I would still be interested in understanding why this is happening...
I am using the AppEngine mapper API (mapreduce) and am having a problem with imports. Here is my file structure:
├── [ost 12] app.yaml -> src/app.yaml
├── [ost 4096] doc
├── [ost 615] fabfile.py
├── [ost 18] gae -> /home/ost/dev/gae/
├── [ost 70] INFO
├── [ost 0] LICENSE
├── [ost 5] README
├── [ost 38] run_clean
├── [ost 64] run_deploy
├── [ost 83] run_pylint
├── [ost 78] run_tests
├── [ost 4096] src
│ ├── [ost 4096] admin
│ ├── [ost 504] app.yaml
│ ├── [ost 4822] data.py
│ ├── [ost 4096] dhandler
│ ├── [ost 2273] ds.html
│ ├── [ost 5424] generator.py
│ ├── [ost 0] __init__.py
│ ├── [ost 3527] lib.py
│ ├── [ost 4211] main.py
│ ├── [ost 457] mappers.py
│ ├── [ost 298] mapreduce.yaml
│ ├── [ost 4192] parser.py
│ └── [ost 4096] static
├── [ost 4096] test
│ └── [ost 2445] test_data.py
└── [ost 98] TODO
My app.yaml is:
application: <removed>
version: 1
runtime: python
api_version: 1
builtins:
- datastore_admin: on
- appstats: on
handlers:
- url: /remote_api
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
login: admin
- url: /admin
script: admin/admin.py
login: admin
- url: /dhandler/.*
script: dhandler/dhandler.py
- url: /mapreduce(/.*)?
script: $PYTHON_LIB/google/appengine/ext/mapreduce/main.py
login: admin
- url: /static
static_dir: static
- url: /.*
script: main.py
My mapreduce.yaml:
mapreduce:
- name: insert-domain-mapper
params:
- name: done_callback
value: /dhandler/insert_job_done
mapper:
input_reader: google.appengine.ext.mapreduce.input_readers.BlobstoreLineInputReader
handler: mappers.insert_domain
params:
- name: blob_keys
default: ""
Finally mappers.py
from google.appengine.ext.mapreduce import operation as op
from data import RegisteredDomain, make_key, clean_domain
def insert_domain((byte_offset, line)):
domain = line
# TODO: domain validity check (??)
# clean domain
domain = clean_domain(domain)
# create domain entity
domain_entity = RegisteredDomain(key_name=make_key(domain))
# yield put operation
yield op.db.Put(domain_entity)
Now the problem is that, although I can load the /mapreduce page and the job is available, as soon as I try to start the job I get the following error (on the page):
ImportError: Could not find 'input_readers' on path 'google.appengine.ext.mapreduce'
Here is a complete stack trace:
DEBUG 2011-09-28 18:30:54,829 dev_appserver.py:3022] Executing CGI with env:
{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_CONNECTION': 'keep-alive',
'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'HTTP_COOKIE': 'dev_appserver_login="test@example.com:True:1858
04764220139124118"', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'CURRENT_VERSION_ID': '1.1', 'SERVER_S
OFTWARE': 'Development/1.0', 'SCRIPT_NAME': '', 'USER_ORGANIZATION': '', 'REQUEST_METHOD': 'GET', 'HTTP_HOST': '10.1
.2.20:8000', 'PATH_INFO': '/mapreduce/status', 'SERVER_PROTOCOL': 'HTTP/1.0', 'QUERY_STRING': '', 'TZ': 'UTC', 'HTTP
_CACHE_CONTROL': 'max-age=0', 'USER_EMAIL': 'test@example.com', 'USER_IS_ADMIN': '1', 'CONTENT_LENGTH': '', 'USER_ID
': '185804764220139124118', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like G
ecko) Chrome/15.0.874.24 Safari/535.2', 'APPLICATION_ID': 'dev~domain-sandwich', 'SERVER_NAME': '10.1.2.20', 'REMOTE
_ADDR': '10.1.2.5', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', 'SDK_VERSION': '1.5.2'
, 'PATH_TRANSLATED': '/home/ost/dev/gae/google/appengine/ext/mapreduce/main.py', 'SERVER_PORT': '8000', 'AUTH_DOMAIN
': 'gmail.com'}
DEBUG 2011-09-28 18:30:54,830 dev_appserver.py:2721] Reusing main() function of module "google.appengine.ext.mapr
educe.main"
INFO 2011-09-28 18:30:54,841 dev_appserver.py:4248] "GET /mapreduce/status HTTP/1.1" 200 -
DEBUG 2011-09-28 18:30:54,843 dev_appserver_index.py:172] No need to update index.yaml
DEBUG 2011-09-28 18:30:54,890 dev_appserver.py:589] Matched "/mapreduce/base.css" to CGI dispatcher with path $PY
THON_LIB/google/appengine/ext/mapreduce/main.py
DEBUG 2011-09-28 18:30:54,894 dev_appserver.py:3022] Executing CGI with env:
{'HTTP_ACCEPT': 'text/css,*/*;q=0.1', 'HTTP_CONNECTION': 'keep-alive', 'CONTENT_TYPE': 'application/x-www-form-urlen
coded', 'HTTP_REFERER': 'http://10.1.2.20:8000/mapreduce/status', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q
=0.3', 'CURRENT_VERSION_ID': '1.1', 'SERVER_SOFTWARE': 'Development/1.0', 'SCRIPT_NAME': '', 'USER_ORGANIZATION': ''
, 'REQUEST_METHOD': 'GET', 'HTTP_HOST': '10.1.2.20:8000', 'PATH_INFO': '/mapreduce/base.css', 'SERVER_PROTOCOL': 'HT
TP/1.0', 'QUERY_STRING': '', 'TZ': 'UTC', 'USER_EMAIL': 'test@example.com', 'USER_IS_ADMIN': '1', 'CONTENT_LENGTH':
'', 'USER_ID': '185804764220139124118', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (K
HTML, like Gecko) Chrome/15.0.874.24 Safari/535.2', 'APPLICATION_ID': 'dev~domain-sandwich', 'HTTP_COOKIE': 'dev_app
server_login="test@example.com:True:185804764220139124118"', 'SERVER_NAME': '10.1.2.20', 'REMOTE_ADDR': '10.1.2.5',
'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', 'SDK_VERSION': '1.5.2', 'PATH_TRANSLATED':
'/home/ost/dev/gae/google/appengine/ext/mapreduce/main.py', 'SERVER_PORT': '8000', 'AUTH_DOMAIN': 'gmail.com'}
DEBUG 2011-09-28 18:30:54,895 dev_appserver.py:2721] Reusing main() function of module "google.appengine.ext.mapr
educe.main"
INFO 2011-09-28 18:30:54,902 dev_appserver.py:4248] "GET /mapreduce/base.css HTTP/1.1" 200 -
DEBUG 2011-09-28 18:30:54,903 dev_appserver_index.py:172] No need to update index.yaml
DEBUG 2011-09-28 18:30:54,911 dev_appserver.py:589] Matched "/mapreduce/jquery.js" to CGI dispatcher with path $P
YTHON_LIB/google/appengine/ext/mapreduce/main.py
DEBUG 2011-09-28 18:30:54,915 dev_appserver.py:3022] Executing CGI with env:
{'HTTP_ACCEPT': '*/*', 'HTTP_CONNECTION': 'keep-alive', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'HTTP_R
EFERER': 'http://10.1.2.20:8000/mapreduce/status', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'CURRENT
_VERSION_ID': '1.1', 'SERVER_SOFTWARE': 'Development/1.0', 'SCRIPT_NAME': '', 'USER_ORGANIZATION': '', 'REQUEST_METH
OD': 'GET', 'HTTP_HOST': '10.1.2.20:8000', 'PATH_INFO': '/mapreduce/jquery.js', 'SERVER_PROTOCOL': 'HTTP/1.0', 'QUER
Y_STRING': '', 'TZ': 'UTC', 'USER_EMAIL': 'test@example.com', 'USER_IS_ADMIN': '1', 'CONTENT_LENGTH': '', 'USER_ID':
'185804764220139124118', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gec
ko) Chrome/15.0.874.24 Safari/535.2', 'APPLICATION_ID': 'dev~domain-sandwich', 'HTTP_COOKIE': 'dev_appserver_login="
test@example.com:True:185804764220139124118"', 'SERVER_NAME': '10.1.2.20', 'REMOTE_ADDR': '10.1.2.5', 'GATEWAY_INTER
FACE': 'CGI/1.1', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', 'SDK_VERSION': '1.5.2', 'PATH_TRANSLATED': '/home/ost/de
v/gae/google/appengine/ext/mapreduce/main.py', 'SERVER_PORT': '8000', 'AUTH_DOMAIN': 'gmail.com'}
DEBUG 2011-09-28 18:30:54,916 dev_appserver.py:2721] Reusing main() function of module "google.appengine.ext.mapr
educe.main"
INFO 2011-09-28 18:30:54,924 dev_appserver.py:4248] "GET /mapreduce/jquery.js HTTP/1.1" 200 -
DEBUG 2011-09-28 18:30:54,931 dev_appserver_index.py:172] No need to update index.yaml
DEBUG 2011-09-28 18:30:54,938 dev_appserver.py:589] Matched "/mapreduce/status.js" to CGI dispatcher with path $P
YTHON_LIB/google/appengine/ext/mapreduce/main.py
DEBUG 2011-09-28 18:30:54,942 dev_appserver.py:3022] Executing CGI with env:
{'HTTP_ACCEPT': '*/*', 'HTTP_CONNECTION': 'keep-alive', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'HTTP_R
EFERER': 'http://10.1.2.20:8000/mapreduce/status', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'CURRENT
_VERSION_ID': '1.1', 'SERVER_SOFTWARE': 'Development/1.0', 'SCRIPT_NAME': '', 'USER_ORGANIZATION': '', 'REQUEST_METH
OD': 'GET', 'HTTP_HOST': '10.1.2.20:8000', 'PATH_INFO': '/mapreduce/status.js', 'SERVER_PROTOCOL': 'HTTP/1.0', 'QUER
Y_STRING': '', 'TZ': 'UTC', 'USER_EMAIL': 'test@example.com', 'USER_IS_ADMIN': '1', 'CONTENT_LENGTH': '', 'USER_ID':
'185804764220139124118', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gec
ko) Chrome/15.0.874.24 Safari/535.2', 'APPLICATION_ID': 'dev~domain-sandwich', 'HTTP_COOKIE': 'dev_appserver_login="
test@example.com:True:185804764220139124118"', 'SERVER_NAME': '10.1.2.20', 'REMOTE_ADDR': '10.1.2.5', 'GATEWAY_INTER
FACE': 'CGI/1.1', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', 'SDK_VERSION': '1.5.2', 'PATH_TRANSLATED': '/home/ost/de
v/gae/google/appengine/ext/mapreduce/main.py', 'SERVER_PORT': '8000', 'AUTH_DOMAIN': 'gmail.com'}
DEBUG 2011-09-28 18:30:54,943 dev_appserver.py:2721] Reusing main() function of module "google.appengine.ext.mapr
educe.main"
INFO 2011-09-28 18:30:54,951 dev_appserver.py:4248] "GET /mapreduce/status.js HTTP/1.1" 200 -
DEBUG 2011-09-28 18:30:54,953 dev_appserver_index.py:172] No need to update index.yaml
DEBUG 2011-09-28 18:30:54,972 dev_appserver.py:589] Matched "/mapreduce/command/list_configs" to CGI dispatcher w
ith path $PYTHON_LIB/google/appengine/ext/mapreduce/main.py
DEBUG 2011-09-28 18:30:54,976 dev_appserver.py:3022] Executing CGI with env:
{'HTTP_ACCEPT': 'text/plain, */*', 'HTTP_CONNECTION': 'keep-alive', 'USER_IS_ADMIN': '1', 'HTTP_COOKIE': 'dev_appser
ver_login="test@example.com:True:185804764220139124118"', 'CURRENT_VERSION_ID': '1.1', 'SERVER_SOFTWARE': 'Developme
nt/1.0', 'SCRIPT_NAME': '', 'USER_ORGANIZATION': '', 'USER_ID': '185804764220139124118', 'REQUEST_METHOD': 'GET', 'H
TTP_HOST': '10.1.2.20:8000', 'PATH_INFO': '/mapreduce/command/list_configs', 'SERVER_PROTOCOL': 'HTTP/1.0', 'QUERY_S
TRING': '', 'TZ': 'UTC', 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest', 'USER_EMAIL': 'test@example.com', 'CONTENT_LENGT
H': '', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WO
W64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.24 Safari/535.2', 'APPLICATION_ID': 'dev~domain-sandwich'
, 'HTTP_REFERER': 'http://10.1.2.20:8000/mapreduce/status', 'SERVER_NAME': '10.1.2.20', 'REMOTE_ADDR': '10.1.2.5', '
CONTENT_TYPE': 'application/x-www-form-urlencoded', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT_LANGUAGE': 'en-US,e
n;q=0.8', 'SDK_VERSION': '1.5.2', 'PATH_TRANSLATED': '/home/ost/dev/gae/google/appengine/ext/mapreduce/main.py', 'SE
RVER_PORT': '8000', 'AUTH_DOMAIN': 'gmail.com'}
DEBUG 2011-09-28 18:30:54,977 dev_appserver.py:2721] Reusing main() function of module "google.appengine.ext.mapr
educe.main"
INFO 2011-09-28 18:30:54,991 dev_appserver.py:4248] "GET /mapreduce/command/list_configs HTTP/1.1" 200 -
DEBUG 2011-09-28 18:30:54,992 dev_appserver_index.py:172] No need to update index.yaml
DEBUG 2011-09-28 18:30:54,999 dev_appserver.py:589] Matched "/mapreduce/command/list_jobs" to CGI dispatcher with
path $PYTHON_LIB/google/appengine/ext/mapreduce/main.py
DEBUG 2011-09-28 18:30:55,003 dev_appserver.py:3022] Executing CGI with env:
{'HTTP_ACCEPT': 'text/plain, */*', 'HTTP_CONNECTION': 'keep-alive', 'USER_IS_ADMIN': '1', 'HTTP_COOKIE': 'dev_appser
ver_login="test@example.com:True:185804764220139124118"', 'CURRENT_VERSION_ID': '1.1', 'SERVER_SOFTWARE': 'Developme
nt/1.0', 'SCRIPT_NAME': '', 'USER_ORGANIZATION': '', 'USER_ID': '185804764220139124118', 'REQUEST_METHOD': 'GET', 'H
TTP_HOST': '10.1.2.20:8000', 'PATH_INFO': '/mapreduce/command/list_jobs', 'SERVER_PROTOCOL': 'HTTP/1.0', 'QUERY_STRI
NG': '', 'TZ': 'UTC', 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest', 'USER_EMAIL': 'test@example.com', 'CONTENT_LENGTH':
'', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64
) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.24 Safari/535.2', 'APPLICATION_ID': 'dev~domain-sandwich', '
HTTP_REFERER': 'http://10.1.2.20:8000/mapreduce/status', 'SERVER_NAME': '10.1.2.20', 'REMOTE_ADDR': '10.1.2.5', 'CON
TENT_TYPE': 'application/x-www-form-urlencoded', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q
=0.8', 'SDK_VERSION': '1.5.2', 'PATH_TRANSLATED': '/home/ost/dev/gae/google/appengine/ext/mapreduce/main.py', 'SERVE
R_PORT': '8000', 'AUTH_DOMAIN': 'gmail.com'}
DEBUG 2011-09-28 18:30:55,003 dev_appserver.py:2721] Reusing main() function of module "google.appengine.ext.mapr
educe.main"
INFO 2011-09-28 18:30:55,012 dev_appserver.py:4248] "GET /mapreduce/command/list_jobs HTTP/1.1" 200 -
DEBUG 2011-09-28 18:30:55,013 dev_appserver_index.py:172] No need to update index.yaml
DEBUG 2011-09-28 18:30:55,019 dev_appserver.py:589] Matched "/favicon.ico" to CGI dispatcher with path main.py
DEBUG 2011-09-28 18:30:55,022 dev_appserver.py:3022] Executing CGI with env:
{'HTTP_ACCEPT': '*/*', 'HTTP_CONNECTION': 'keep-alive', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'HTTP_C
OOKIE': 'dev_appserver_login="test@example.com:True:185804764220139124118"', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-
8;q=0.7,*;q=0.3', 'CURRENT_VERSION_ID': '1.1', 'SERVER_SOFTWARE': 'Development/1.0', 'SCRIPT_NAME': '', 'USER_ORGANI
ZATION': '', 'REQUEST_METHOD': 'GET', 'HTTP_HOST': '10.1.2.20:8000', 'PATH_INFO': '/favicon.ico', 'SERVER_PROTOCOL':
'HTTP/1.0', 'QUERY_STRING': '', 'TZ': 'UTC', 'USER_EMAIL': 'test@example.com', 'USER_IS_ADMIN': '1', 'CONTENT_LENGT
H': '', 'USER_ID': '185804764220139124118', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.
2 (KHTML, like Gecko) Chrome/15.0.874.24 Safari/535.2', 'APPLICATION_ID': 'dev~domain-sandwich', 'SERVER_NAME': '10.
1.2.20', 'REMOTE_ADDR': '10.1.2.5', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', 'SDK_V
ERSION': '1.5.2', 'PATH_TRANSLATED': '/home/ost/dev/domain-sandwich/src/main.py', 'SERVER_PORT': '8000', 'AUTH_DOMAI
N': 'gmail.com'}
DEBUG 2011-09-28 18:30:55,022 dev_appserver.py:2721] Reusing main() function of module "main"
INFO 2011-09-28 18:30:55,028 dev_appserver.py:4248] "GET /favicon.ico HTTP/1.1" 404 -
DEBUG 2011-09-28 18:30:55,029 dev_appserver_index.py:172] No need to update index.yaml
DEBUG 2011-09-28 18:30:56,662 dev_appserver.py:589] Matched "/mapreduce/command/start_job" to CGI dispatcher with
path $PYTHON_LIB/google/appengine/ext/mapreduce/main.py
DEBUG 2011-09-28 18:30:56,670 dev_appserver.py:3022] Executing CGI with env:
{'HTTP_COOKIE': 'dev_appserver_login="test@example.com:True:185804764220139124118"', 'SERVER_SOFTWARE': 'Development
/1.0', 'SCRIPT_NAME': '', 'REQUEST_METHOD': 'POST', 'PATH_INFO': '/mapreduce/command/start_job', 'HTTP_ORIGIN': 'htt
p://10.1.2.20:8000', 'SERVER_PROTOCOL': 'HTTP/1.0', 'QUERY_STRING': '', 'CONTENT_LENGTH': '232', 'HTTP_ACCEPT_CHARSE
T': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHT
ML, like Gecko) Chrome/15.0.874.24 Safari/535.2', 'TZ': 'UTC', 'HTTP_REFERER': 'http://10.1.2.20:8000/mapreduce/stat
us', 'SERVER_NAME': '10.1.2.20', 'REMOTE_ADDR': '10.1.2.5', 'SDK_VERSION': '1.5.2', 'PATH_TRANSLATED': '/home/ost/de
v/gae/google/appengine/ext/mapreduce/main.py', 'SERVER_PORT': '8000', 'USER_IS_ADMIN': '1', 'HTTP_X_REQUESTED_WITH':
'XMLHttpRequest', 'CURRENT_VERSION_ID': '1.1', 'USER_ORGANIZATION': '', 'USER_ID': '185804764220139124118', 'HTTP_H
OST': '10.1.2.20:8000', 'HTTP_CONNECTION': 'keep-alive', 'USER_EMAIL': 'test@example.com', 'HTTP_ACCEPT': 'text/plai
n, */*', 'APPLICATION_ID': 'dev~domain-sandwich', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;
q=0.8', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'AUTH_DOMAIN': 'gmail.com'}
DEBUG 2011-09-28 18:30:56,671 dev_appserver.py:2721] Reusing main() function of module "google.appengine.ext.mapr
educe.main"
DEBUG 2011-09-28 18:30:56,688 dev_appserver.py:2198] Could not import "_io": Disallowed C-extension or built-in m
odule
DEBUG 2011-09-28 18:30:56,689 util.py:105] Could not import BlobstoreLineInputReader from google.appengine.ext.ma
preduce.input_readers. Will try recursively.
Traceback (most recent call last):
File "/home/ost/dev/gae/google/appengine/ext/mapreduce/util.py", line 90, in for_name
result = __import__(module_name, None, None, [short_name])
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2503, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2375, in FindAndLoadModule
description)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2318, in LoadModuleRestricted
description)
File "/home/ost/dev/gae/google/appengine/ext/mapreduce/input_readers.py", line 59, in <module>
import zipfile
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2503, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2375, in FindAndLoadModule
description)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2318, in LoadModuleRestricted
description)
File "/usr/lib/python2.7/zipfile.py", line 6, in <module>
import io
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2503, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2375, in FindAndLoadModule
description)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2318, in LoadModuleRestricted
description)
File "/usr/lib/python2.7/io.py", line 60, in <module>
import _io
ImportError: No module named _io
DEBUG 2011-09-28 18:30:56,698 dev_appserver.py:2198] Could not import "_io": Disallowed C-extension or built-in m
odule
DEBUG 2011-09-28 18:30:56,698 util.py:105] Could not import input_readers from google.appengine.ext.mapreduce. Wi
ll try recursively.
Traceback (most recent call last):
File "/home/ost/dev/gae/google/appengine/ext/mapreduce/util.py", line 90, in for_name
result = __import__(module_name, None, None, [short_name])
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2503, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2375, in FindAndLoadModule
description)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2318, in LoadModuleRestricted
description)
File "/home/ost/dev/gae/google/appengine/ext/mapreduce/input_readers.py", line 59, in <module>
import zipfile
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2503, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2375, in FindAndLoadModule
description)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2318, in LoadModuleRestricted
description)
File "/usr/lib/python2.7/zipfile.py", line 6, in <module>
import io
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2503, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2375, in FindAndLoadModule
description)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "/home/ost/dev/gae/google/appengine/tools/dev_appserver.py", line 2318, in LoadModuleRestricted
description)
File "/usr/lib/python2.7/io.py", line 60, in <module>
import _io
ImportError: No module named _io
ERROR 2011-09-28 18:30:56,702 base_handler.py:140] Error in JsonHandler, returning exception.
Traceback (most recent call last):
File "/home/ost/dev/gae/google/appengine/ext/mapreduce/base_handler.py", line 133, in _handle_wrapper
self.handle()
File "/home/ost/dev/gae/google/appengine/ext/mapreduce/handlers.py", line 762, in handle
_app=mapper_params.get("_app"))
File "/home/ost/dev/gae/google/appengine/ext/mapreduce/handlers.py", line 826, in _start_map
mapper_input_reader_class = mapper_spec.input_reader_class()
File "/home/ost/dev/gae/google/appengine/ext/mapreduce/model.py", line 408, in input_reader_class
return util.for_name(self.input_reader_spec)
File "/home/ost/dev/gae/google/appengine/ext/mapreduce/util.py", line 109, in for_name
module = for_name(module_name, recursive=True)
File "/home/ost/dev/gae/google/appengine/ext/mapreduce/util.py", line 117, in for_name
short_name, module_name))
ImportError: Could not find 'input_readers' on path 'google.appengine.ext.mapreduce' (????)
INFO 2011-09-28 18:30:56,710 dev_appserver.py:4248] "POST /mapreduce/command/start_job HTTP/1.1" 200 -
DEBUG 2011-09-28 18:30:56,711 dev_appserver_index.py:172] No need to update index.yaml
回答1:
This may be the same problem I was having -- I was using the 2.7 version of the Python Interpreter in my local environment. When I switched to 2.5, it works fine.
来源:https://stackoverflow.com/questions/7587675/appengine-mapper-api-import-error