I have a set of python files which make up a program for saving tidbits of info and searching them via tag association. I had the program working for many versions, but I recently made what I thought was a minor change that caused the program to go haywire. The ENTRY object is the basis of the data storage - it holds a unique ID number, a nickname, a value, and a list of tags.
class ENTRY:
def __init__(self, idNum, nickName, value, tagList):
self.idNum = idNum
self.nickName = nickName
self.value = value
self.tagList = tagList
I realized that I was interchangeably referring to the "nickName" attribute as "name" when asking for input in other files, so I decided to Find and Replace all mentions of "nickName" with "name" to make the code easier to follow. I did this in the ENTRY.py file as well as all of the associated python files in the program. I even proofread them to make sure the change did not mess with any case-sensitive function calls or anything.
The problem: Now, when I run the program, I get an attribute error:
Traceback (most recent call last):
File "/Memory/TagMem.py", line 210, in <module>
main()
File "/Memory/TagMem.py", line 207, in main
dispatch(userChoice)
File "/Memory/TagMem.py", line 171, in dispatch
nameList('todo')
File "/Memory/TagMem.py", line 103, in nameList
memory.searchListNames(queryList)
File "/Memory/Memory.py", line 96, in searchListNames
each.printName()
File "/Memory/ENTRY.py", line 49, in printName
print("({}) {}".format(self.idNum, self.name))
AttributeError: 'ENTRY' object has no attribute 'name'
But after the Find and Replace, the ENTRY object most certainly has an attribute 'name':
class ENTRY:
def __init__(self, idNum, name, value, tagList):
self.idNum = idNum
self.name = name
self.value = value
self.tagList = tagList
Does anyone know of a reason I would get an attribute error when the attribute is very clearly defined in the class constructor?
For more complete information on the full class code, see the github repository: https://github.com/kylelambert101/TagMem
And the specific commit with the crash-inducing changes: https://github.com/kylelambert101/TagMem/commit/68987f2e6ed98012f36ec5230b3dac6f09373489
Thank you!