Google App Engine Cron Jon failing with following error

43 views
Skip to first unread message

Khalid Razzaq

unread,
Mar 14, 2016, 2:28:05 PM3/14/16
to Google App Engine

Same code deployed on development system works fine but once deployed to production fails with following error:


Traceback (most recent call last): File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler handler, path, err = LoadObject(self._handler) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject obj = __import__(path[0]) ImportError: No module named urlhandlers

Following is the URL Handler code

import traceback
import datetime
from google.appengine.api import taskqueue
import re
import webapp2
from utilities.logger import logThis, AEL_LEVEL_INFO, AEL_LEVEL_CRITICAL
from constants.constants import GAET_MASTERTASK_NAME, GAEQ_FOR_MASTERTASK
import sys

class QueueAMasterTask(webapp2.RequestHandler): 
    def get(self):
        try:
            dt =datetime.datetime.now()
            logThis(AEL_LEVEL_INFO, 'Master Task added to its Q at[%s]' %(dt))            
            task_name = GAET_MASTERTASK_NAME + str(datetime.datetime.now())
            task_name = re.sub('[^a-zA-Z0-9_-]', '_', task_name)
            taskqueue.add(queue_name=GAEQ_FOR_MASTERTASK,name=task_name)
            logThis(AEL_LEVEL_INFO, "OK-MASTER TASK ADD")
        except taskqueue.DuplicateTaskNameError:
            logThis(AEL_LEVEL_CRITICAL, "EXCEPTION on QueueAMasterTask-" +     traceback.format_exc())
        except:
            logThis(AEL_LEVEL_CRITICAL, "EXP on QueueAMasterTask-" +     traceback.format_exc())

app = webapp2.WSGIApplication([('/QueueAMasterTask', QueueAMasterTask)
               ], debug=True)

Khalid Razzaq

unread,
Mar 14, 2016, 2:31:49 PM3/14/16
to Google App Engine
There is one realted error I'm getting as well

/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py:85: ImportWarning: Not importing directory '/base/data/home/apps/s~apps-1149/1.391373453171312456/urlhandlers': missing __init__.py

Can it be because I'm importing some custom libraries?

Christian F. Howes

unread,
Mar 14, 2016, 7:27:04 PM3/14/16
to Google App Engine
yes.  your custom libraries must not be quite right on the GAE path.  i recommend setting up a virtualenv for your local machine that does not have any system packages that GAE does not have, and that will help you make sure your included library paths are correct.
Reply all
Reply to author
Forward
0 new messages