Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8583539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:33:43+00:00 2026-06-11T21:33:43+00:00

I am using uwsgi decorators(specifically the cron decorator) to do things at specific times.

  • 0

I am using uwsgi decorators(specifically the cron decorator) to do things at specific times. I have the following code:

import cherrypy
import uwsgidecorators

class TestObject(object):
    @cherrypy.expose
    def index(self):
        launchapp = self.launchapp(-1,-1,-1,-1,-1,"foobar")
        return "This is a test"

    @uwsgidecorators.cron(minute,hour,day,month,dayweek)
    def launchapp(self,target):
        print "the target is %s" %target
        return

However I get the error:

    @uwsgidecorators.cron(minute,hour,day,month,dayweek)
NameError: name 'minute' is not defined

I am basically trying to specify the timing parameters for the cron decorator in the index function. Anyone know what I am doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:33:44+00:00Added an answer on June 11, 2026 at 9:33 pm

    Why your code fails

    The error has nothing to do with the fact that you’re passing parameters, it’s just that the minute variable is undefined.

    You would get the exact same error doing:

    >>> a = 'a'
    >>> print b
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'b' is not defined
    >>> 
    

    What you probably want to do is:

    @uwsgidecorators.cron(minute = 5,hour = 2, # and so on.
    

    Please have a look at the uwsgi documentation for a more comprehensive example.


    — EDIT below.

    How you could fix it

    It seems that you’re trying to add a task to your crontab after index is hit.

    That’s not the use case for the decorator, the decorator is only meant to say that a function should run on a cron at function definition.
    Basically, when the decorator is executed (and the function defined, not called), it gets added to the crontab.

    In your case, you want to add a function to the crontab; so you should use something like uwsgi.add_cron. You can have a look at the decorator code to see how you could use it.

    You shouldn’t be using a method but a function, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My goal is to define a RESTful api using CherryPy (wsgi) + uWSGI +
Using the ndk I have compiled a code written in C. The program is
I have a nginx + uwsgi website (using Flask for dynamic python pages). I
I am running cherokee to serve a django app using uwsgi. I have been
I'm using uwsgi on Nginx to run some Python code. I'd like to bind
Say I have a Flask application, served by uWSGI using multiple processes, like: uwsgi
Using import datetime in python, is it possible to take a formatted time/date string
Has anyone tried using uWSGI with Cherokee? Can you share your experiences and what
I'm using django-piston for my REST json api, and I have it all set
Using android 2.3.3, I have a background Service which has a socket connection. There's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.