You have two problems with the code. The first is in buildName
, and I've commented it:
def buildName(self):
langName = 'names_'+self.language.upper()+'.txt'
print 'Current Loaded Names:'+langName+'.' # <-- removed parens
return langName # <-- this is returned. no need to try to access outside the func
The second is in the call to that. l10n.buildName
needs to be called, which returns langName
for you, which doesn't need to be looked up.
names = [l.strip('\n\r').split('*')[1:] for l in open(pp+'data/etc/'+l10n.buildName()+'',"r").readlines() if not l.startswith('#')]