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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:10:57+00:00 2026-06-14T03:10:57+00:00

so such a problem, that i can’t figure it out. Maybe i have too

  • 0

so such a problem, that i can’t figure it out. Maybe i have too little Python knowledge.

The problem is, that after this function runs once smoothly, another time i get error in another function.

Function, after which things break:

    def setFixedPriority( self, priority, lister ):
    step = priority / lister . __len__ ( )
    for j in range( 0, lister . __len__( ) ):
        for i in range( 0, self . listOfJobs . __len__ ( ) ) :
            if self . listOfJobs[ i ] . category == lister[ j ]:
                self . listOfJobs[ i ] . priority += priority
            elif self . listOfJobs[ i ] . jobType == lister[ j ]:
                self . listOfJobs[ i ] . priority += priority
            elif self . listOfJobs[ i ] . timeToDo == lister[ j ]:
                self . listOfJobs[ i ] . priority += priority
        priority -= step
            self . sortByPriority( )

Function in which appears the problem:

    def sortByPriority( self ) :
    tmp = range ( 1, self . listOfJobs . __len__ ( ) + 1 )
    for i in reversed ( tmp ) :
        for j in range ( 1, i ) :
            if self . listOfJobs [ j - 1 ] . priority < self . listOfJobs [ j ] . priority :
                self . listOfJobs [ j - 1 ], 
                self . listOfJobs [ j ] = self . listOfJobst [ j ], 
                self . listOfJobs [ j - 1 ]

Calling the function (From different python script/file/class):

    self . jobs . setFixedPriority( int( self . settings[ 'Spinbox1' ] ), self . settings[ 'type' ] . split( ":" ) )

And the error i get:

    File "data/ToDoListClass.py", line 82, in sortByPriority
    self . listOfJobs [ j ] = self . listOfJobst [ j ], 
    AttributeError: jobList instance has no attribute 'listOfJobst'

I know that the sortByPriority works OK, because i am calling this once before setFixedPriority and it does not give me errors.

What could cause this to happen?

  • 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-14T03:10:58+00:00Added an answer on June 14, 2026 at 3:10 am
    AttributeError: jobList instance has no attribute 'listOfJobst'
    

    If you look closely, you have a typo there. The attribute is called listOfJobs without a trailing t.

    Note that while this will make go of the error, this will probably not fix the function:

    self . listOfJobs [ j - 1 ], 
    self . listOfJobs [ j ] = self . listOfJobs [ j ], 
    self . listOfJobs [ j - 1 ]
    

    That construct is probably supposed to swap listOfJobs[j] and listOfJobs[j - 1]. Due to the line breaks, this will do the following though:

    1. Make a one-tuple with listOfJobs[j - 1] (nothing else happens with that)
    2. Assign a one-tuple with listOfJobs[j] to listOfJobs[j].
    3. Access listOfJobs[j - 1] (again, nothing else happens).

    What you want to do is to write it either in one line:

    self.listOfJobs[j - 1], self.listOfJobs[j] = self.listOfJobs[j], self.listOfJobs[j - 1]
    

    Or if you want to keep line breaks, use Python’s \ syntax to make the line continue:

    self.listOfJobs[j - 1], \
    self.listOfJobs[j] = self.listOfJobs[j], \
    self.listOfJobs[j - 1]
    

    Although I would argue if that makes it really clear what happens.

    Finally, you can clean your code up a lot. You can directly iterate over lists, and you can also check multiple conditions in a single if. And lastly, Python’s sort function allows you to specify a custom comparison function so that you don’t need to implement an own sorting algorithm but can use Python’s implementation. All in all, you could for example end up with just something like this:

    def setFixedPriority (self, priority, listers):
        step = priority / len(listers)
        for lister in listers:
            for job in self.listOfJobs:
                if job.category == lister or job.jobType == lister or job.timeToDo == lister:
                    job.priority += priority
    
            priority -= step
    
        self.listOfJobs.sort(key=lambda x: x.priority)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What approach can I take to solve my problem such that my Android app
I have a problem such that i have zip files uploaded from forms and
This is such a simple problem, but I can't find an answer anywhere... I
I have such a basic problem in Delphi,I can't solve it. My Code: Note:DataR
this must be such a simple problem but can someone tell me why this
I have a problem that can be simplified as follows: I have a particular
I have an array that can store numbers in such as 01, 01A, 01B,
I have a a strange problem that I can't seem to identify the cause
I have an OO problem that I think can be tied back to Generic
(This is not exactly the problem that I have, but it's isomorphic, and I

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.