def genName(self): # ensure proper encoding # read file, needs to be encoded by utf_8 f = codecs.open(DATA_PATH + "NORDIC_H.txt", encoding='utf_8') firstName = Reader.random_line(f) firstName = firstName.rstrip() f = codecs.open(DATA_PATH + "NORDIC_H.txt", encoding='utf_8') lastName = Reader.random_line(f) lastName = lastName.rstrip() return firstName + " " + lastName