views:

856

answers:

8

I've decided to try out this project:

http://code.google.com/p/appengine-admin/wiki/QuickStart

For the sake of the experiment, I took the demo guest-book shipped with app-engine. The import park look like this:

import cgi
import datetime
import wsgiref.handlers

from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google import appengine_admin

The db model and the admin look like this

class Greeting(db.Model):

 author = db.UserProperty()
 content = db.StringProperty(multiline=True)
 date = db.DateTimeProperty(auto_now_add=True)

class AdminGreeting(appengine_admin.ModelAdmin):

 model = Greeting
 listFields = ('author','content','date')
 editFields = ('author','content','date')

appengine_admin.register(AdminGreeting)

Yet I get this exception, trying to run the site:

File "/home/<username>/python/google_appengine/google/appengine/tools/    dev_appserver.py", line 2875, in _HandleRequest
    base_env_dict=env_dict)
  File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 387, in Dispatch
    base_env_dict=base_env_dict)
  File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 2162, in Dispatch
    self._module_dict)
  File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 2080, in ExecuteCGI
    reset_modules = exec_script(handler_path, cgi_path, hook)
  File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1976, in ExecuteOrImportScript
    exec module_code in script_module.__dict__
  File "/home/<username>/python/google_appengine/demos/guestbook/guestbook.py", line 37, in <module>
    appengine_admin.register(AdminGreeting)
  File "/home/<username>/python/google_appengine/google/appengine_admin/model_register.py", line 120, in register
    modelAdminInstance = modelAdminClass()
  File "/home/<username>/python/google_appengine/google/appengine_admin/model_register.py", line 64, in __init__
    self._extractProperties(self.listFields, self._listProperties)
  File "/home/<username>/python/google_appengine/google/appengine_admin/model_register.py", line 76, in _extractProperties
    storage.append(PropertyWrapper(getattr(self.model, propertyName), propertyName))
  File "/home/<username>/python/google_appengine/google/appengine_admin/model_register.py", line 17, in __init__
    logging.info("Caching info about property '%s'" % name)
  File "/usr/lib/python2.6/logging/__init__.py", line 1451, in info
    root.info(*((msg,)+args), **kwargs)
  File "/usr/lib/python2.6/logging/__init__.py", line 1030, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python2.6/logging/__init__.py", line 1142, in _log
record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
  File "/usr/lib/python2.6/logging/__init__.py", line 1117, in makeRecord
rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
  File "/usr/lib/python2.6/logging/__init__.py", line 272, in __init__
from multiprocessing import current_process
  File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1089, in decorate
return func(self, *args, **kwargs)
  File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1736, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
  File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1089, in decorate
    return func(self, *args, **kwargs)
  File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1638, in FindAndLoadModule
description)
  File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1089, in decorate
return func(self, *args, **kwargs)
  File "/home/<username>/python/google_appengine/google/appengine/tools/dev_appserver.py", line 1589, in LoadModuleRestricted
description)
  File "/usr/lib/python2.6/multiprocessing/__init__.py", line 83, in <module>
    import _multiprocessing
ImportError: No module named _multiprocessing
INFO     2009-04-25 23:34:27,628 dev_appserver.py:2934] "GET / HTTP/1.1" 500 -

Any idea what could have went wrong?

+4  A: 

You appear to be using Python 2.6 (given that some of the messages are from files in /usr/lib/python2.6 ...!), but Google App Engine needs Python 2.5 (any 2.5.x will do for any versions of x), so you should install and use that to run the App Engine SDK.

Alex Martelli
Further, he's using a windows install with a broken _multiprocessing module. Fixing that would also likely make it work, though installing Python 2.5 is preferable.
Nick Johnson
A: 

It wired that I have been using GAE with python2.6(probably 2.6.1), and every thing worked fine.

But now I get the same _multiprocess import error.(python2.6.2).

+1  A: 

just do the following at the top of your something.py

import logging logging.logMultiprocessing = 0

A: 
import logging
logging.logMultiprocessing = 0

Worked for me

refack
A: 
import logging
logging.logMultiprocessing = 0

Worked for me too. Before uploading to GAE, comment those lines.

+2  A: 

Google App Engine only supports Python 2.5, and you're on a newer version.

By the look of your directories, you might be on a Linux (or is it a Mac?). On, say, Ubuntu you can "sudo apt-get install python2.5" (it won't affect your Python 2.6 at all), and then rather than:

<path-to-gae>/dev_appserver.py ...

do

python2.5 <path-to-gae>/dev_appserver.py ...

This is better than just blithely developing on 2.6 and deploying on 2.5 which is surely asking for hassles later on.

sgraham
+1  A: 

To make this work on my local machine (with 2.6) and on GAE, I used:

import sys, logging
if sys.version[:3] == "2.6": logging.logMultiprocessing = 0
+2  A: 

As others have said, this problem occurs in Python 2.6. I used the fix proposed in this comment in the App Engine issue tracker:

A quickfix is to create a file in your app's root named `_multiprocessing.py' with 
the contents:

  import multiprocessing

This way it's possible to import the _multiprocessing module.

It worked for me using Python 2.6.2

Cheers,
Kaji
Roberto Bonvallet