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 7958915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:29:34+00:00 2026-06-04T04:29:34+00:00

I am trying to make a custom command to run on my celery crontabs,

  • 0

I am trying to make a custom command to run on my celery crontabs, which extracts data from my db, makes a list, and then dumps that information as a list in redis. This list will then be used by other workers.

However, I am getting a NameError, which I haven’t been able to solve despite reading relevant stack and Google posts.

My code below:

from django.core.management.base import NoArgsCommand, CommandError
from detail.models import SD
import redis

class Command(NoArgsCommand):

    help = 'Gathers the symbols from the database and generates a list for crontabs, saving to redis.'

    def handle_noargs(self, **options):

        all = SD.objects.all()

        data = []

        for info in all:
            data.append(info.symb)  

        r = redis.Redis()

        try:
            r.delete('allsymbols')
        except:
            pass

        for xyz in data: **<---- the NameError refers to this line**
            r.rpush('allsymbols', xyz)

TRACEBACK

File "C:\.....command.py", line 5, in <module>
class Command(NoArgsCommand):
File "C:\.....command.py", line 26, in Command
for xyz in data:

NameError: name ‘data’ is not defined

  • 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-04T04:29:35+00:00Added an answer on June 4, 2026 at 4:29 am

    Script contains mixed tabs and spaces.

    You should rather use only spaces, as per pep8, but the choice is yours, as long as you use the same in all your scripts.

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

Sidebar

Related Questions

I'm trying to make Core Data objects inherit from my own custom class rather
I am trying to make Custom RelativeLayout which can scale and scroll. Right now
Trying to make a custom :confirm message for a rails form that returns data
I'm trying to make a custom view in Django admin. I'm reading from this
I'm trying to make a custom converter that inherits from DependencyObject , but it
Im trying to make custom icons for my HTC EVO, which is running Cyanogen
I am trying to make a custom filter in Lucene which simply recognizes whether
I'm trying to make a custom text view that has the font set from
I´m trying to make a custom component to javafx, so I make my class
Im trying to make my custom TTreeNode Class for example TCustomTreeNode = class(TTreeNode) private

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.