Search Results

Search found 2 results on 1 pages for 'ccwhite1'.

Page 1/1 | 1 

  • python object AttributeError: type object 'Track' has no attribute 'title'

    - by ccwhite1
    I apologize if this is a noob question, but I can't seem to figure this one out. I have defined an object that defines a music track (NOTE: originally had the just ATTRIBUTE vs self.ATTRIBUTE. I edited those values in to help remove confusion. They had no affect on the problem) class Track(object): def __init__(self, title, artist, album, source, dest): """ Model of the Track Object Contains the followign attributes: 'Title', 'Artist', 'Album', 'Source', 'Dest' """ self.atrTitle = title self.atrArtist = artist self.atrAlbum = album self.atrSource = source self.atrDest = dest I use ObjectListView to create a list of tracks in a specific directory ....other code.... self.aTrack = [Track(sTitle,sArtist,sAlbum,sSource, sDestDir)] self.TrackOlv.AddObjects(self.aTrack) ....other code.... Now I want to iterate the list and print out a single value of each item list = self.TrackOlv.GetObjects() for item in list: print item.atrTitle This fails with the error AttributeError: type object 'Track' has no attribute 'atrTitle' What really confuses me is if I highlight a single item in the Object List View display and use the following code, it will correctly print out the single value for the highlighted item list = self.TrackOlv.GetSelectedObject() print list.atrTitle

    Read the article

  • Python GUI does not update until entire process is finished

    - by ccwhite1
    I have a process that gets a files from a directory and puts them in a list. It then iterates that list in a loop. The last line of the loop being where it should update my gui display, then it begins the loop again with the next item in the list. My problem is that it does not actually update the gui until the entire process is complete, which depending on the size of the list could be 30 seconds to over a minute. This gives the feeling of the program being 'hung' What I wanted it to do was to process one line in the list, update the gui and then continue. Where did I go wrong? The line to update the list is # Populate listview with drive contents. The print statements are just for debug. def populateList(self): print "populateList" sSource = self.txSource.Value sDest = self.txDest.Value # re-intialize listview and validated list self.listView1.DeleteAllItems() self.validatedMove = None self.validatedMove = [] #Create list of files listOfFiles = getList(sSource) #prompt if no files detected if listOfFiles == []: self.lvActions.Append([datetime.datetime.now(),"Parse Source for .MP3 files","No .MP3 files in source directory"]) #Populate list after both Source and Dest are chosen if len(sDest) > 1 and len(sDest) > 1: print "-iterate listOfFiles" for file in listOfFiles: sFilename = os.path.basename(file) sTitle = getTitle(file) sArtist = getArtist(file) sAlbum = getAblum(file) # Make path = sDest + Artist + Album sDestDir = os.path.join (sDest, sArtist) sDestDir = os.path.join (sDestDir, sAlbum) #If file exists change destination to *.copyX.mp3 sDestDir = self.defineDestFilename(os.path.join(sDestDir,sFilename)) # Populate listview with drive contents self.listView1.Append([sFilename,sTitle,sArtist,sAlbum,sDestDir]) #populate list to later use in move command self.validatedMove.append([file,sDestDir]) print "-item added to SourceDest list" else: print "-list not iterated"

    Read the article

1