Question

I do the following:

from google.appengine.ext import deferred

def send_message(client_id, message):
    logging.info("sending message...")

class MyHandler(webapp.RequestHandler):
    def get(self, field_name):
        ...
        scUpdate = {
                       'val': value,
                       'name': field_name_converted
                   }
        message = simplejson.dumps(scUpdate)                      
        deferred.defer(send_message, client_id, message, _countdown=random.randrange(0, 5, 1))

and getting

PermanentTaskFailure: 'module' object has no attribute 'send_message'

What is wrong here?

Upd. looks like the problem is the same as described there - PermanentTaskFailure: 'module' object has no attribute 'Migrate' - but I don't understand how to fix that.

Was it helpful?

Solution

See https://developers.google.com/appengine/articles/deferred:

Limitations of the deferred library

  • You can't call a method in the request handler module.

The function that is called via deferred.defer must not be in the same module like the request handler where deferred.defer is called.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top