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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:02:57+00:00 2026-05-29T16:02:57+00:00

I am using dateutil rrule function .. i get the weekdays from my data

  • 0

I am using dateutil rrule function .. i get the weekdays from my data model in django. when i put it in rrule function like this

for x in lgs:
    teams = Team.objects.filter(league=x.id)
    teamcount = len(teams)
    playdays = "rrule." + str(x.play_days)
    fixdays = rrule.rrule(rrule.DAILY,byweekday = (playdays),dtstart=startdate,until=endate)
    print list(fixdays)

Traceback (most recent call last):
File "<console>", line 5, in <module>
File "/usr/lib/pymodules/python2.7/dateutil/rrule.py", line 345, in __init__
    elif not wday.n or freq > MONTHLY:
AttributeError: 'str' object has no attribute 'n'

if i use the function normally, and replace line 5 with

    fixdays = rrule.rrule(rrule.DAILY,byweekday = (rrule.SU, rrule.MO),dtstart=startdate,until=endate)

i get no problem. what could be 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-05-29T16:02:58+00:00Added an answer on May 29, 2026 at 4:02 pm
    (rrule.SU, rrule.MO)
    

    is a list (tuple) of dateutil.rrule.weekday objects, while

    "rrule." + str(x.play_days)
    

    is a string (that does not have the .n attribute).

    You could define a dictionary:

    weekday = {'MO': rrule.MO, 'TU': rrule.TU, … }
    

    and then call it:

    playdays = weekday[str(x.play_days)]
    

    Also, remember that

    byweekday = (playdays)
    

    is the same as

    byweekday = playdays
    

    If you want to define a tuple from single element, add comma:

    byweekday = (playdays,)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using jQuery, how do I get the value from a textbox and then load
I have get the date from excel sheet using POI using the below code,
I'm using core data and I have an entity defined called LogRecord. Elsewhere this
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Given datetime.datetime.now(), how do I get this week's Monday - Sunday and then the
Using Delphi, I need a function to evaluate the current date and see if
Using Rails 3.2.0 with haml and sass: I Would like to link an external
Using the RichTextArea in GWT, It looks like I can only change the font
I'm using the python dateutil module for a calendaring application which supports repeating events.

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.