On Sat, Oct 3, 2009 at 1:16 PM, David <[email protected]> wrote:

>
> Hi Nick
>
> Even when I replace my grabber with the below, the cron still fails.
> By this I mean that when I look in the dashboard and click the cron
> jobs, it says that the cron has failed.
>
> I don't really understand why. I think my problem is somewhere
> "webapp.WSGIApplication" call, and the app.yaml/ cron.yaml
>

When you see your cron job failed, you need to open the Logs page of the
Admin Console and look for its log entry to discover why.


>
> As I say its such a basic example I would of thought it would run? Or
> am I deluded?
>
> Cheers
>
>
> grabber.py
> **********
>
> from google.appengine.api import users
> from google.appengine.ext import webapp
> from google.appengine.ext.webapp.util import run_wsgi_app
>
> class grabber(webapp.RequestHandler):
>  def get(self):
>       x = "hello"
>
> application = webapp.WSGIApplication(
>                                     [('/', 'grabber')],
>

'grabber' should not be quoted - it's an identifier, not a string.

-Nick Johnson



>                                     debug=True)
>
> def main():
>  run_wsgi_app(application)
>
> if __name__ == "__main__":
>  main()
>
>
>
> On Oct 2, 9:55 am, "Nick Johnson (Google)" <[email protected]>
> wrote:
> > Hi David,
> > You didn't actually say in your message what the problem you're
> encountering
> > is. However, one issue with your cron script is that you're attempting to
> > get the current user in it. Although the cron system can access 'login'
> and
> > 'admin' URLs, it does not have a user account, so get_current_user will
> > always return None.
> >
> > -Nick Johnson
> >
> >
> >
> > On Thu, Oct 1, 2009 at 10:24 PM, David <[email protected]>
> wrote:
> >
> > > Hi
> >
> > > I'm obviously a novice to the app engine, I have been tinkering with
> > > it off and on for a bit. I've spent a stupid amount of time today
> > > trying to figure out why this doesnt work.
> >
> > > I have a cron job to perform a cron every 5 minutes (I will include
> > > everything below) at first I thought it must be my code - but then I
> > > tried using some code from the google pages -
> >
> > > Any clues? I'm finding it really hard to debug - I can't see how I get
> > > a message that says where its blown up, am I being stupid?
> >
> > > grabber.py
> > > ^^^^^^^^^^^^
> >
> > > from google.appengine.api import users
> > > from google.appengine.ext import webapp
> > > from google.appengine.ext.webapp.util import run_wsgi_app
> >
> > > class grabber(webapp.RequestHandler):
> > >  def get(self):
> > >    user = users.get_current_user()
> >
> > >    if user:
> > >      self.response.headers['Content-Type'] = 'text/plain'
> > >      self.response.out.write('Hello, ' + user.nickname())
> > >    else:
> > >      self.redirect(users.create_login_url(self.request.uri))
> >
> > > application = webapp.WSGIApplication(
> > >                                     [('/', 'grabber')],
> > >                                     debug=True)
> >
> > > def main():
> > >  run_wsgi_app(application)
> >
> > > if __name__ == "__main__":
> > >  main()
> >
> > > cron.yaml
> > > ************
> >
> > > cron:
> > > - description: grabs some data
> > >  url: /grabber
> > >  schedule: every 1 minutes
> >
> > > app.yaml
> > > ***********
> >
> > > application: ##My application name usually here
> > > version: 1
> > > runtime: python
> > > api_version: 1
> >
> > > handlers:
> > > - url: /grabber
> > >  script: grabber.py
> >
> > > - url: /
> > >  script: main.py
> >
> > > - url: /favicon.ico
> > >  static_files: favicon.ico
> > >  upload: favicon.ico
> >
> > --
> > Nick Johnson, Developer Programs Engineer, App Engine
> > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration
> Number:
> > 368047
> >
>


-- 
Nick Johnson, Developer Programs Engineer, App Engine
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
368047

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to