문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top