my inheritence isnt working, it says saveAttributes isnt defined:

#!/usr/bin/env python

#==========================================#
# Copyright Tom Tetlaw & Shadwick (c) 2009 #
#==========================================#

import pickle as pk

from formatting import *
from locations import *
from gclasses import *
from gfuncs import *
from items import *
from objs import *


class Actor(object):
    def __init__(self, name, age, race, profession):
        self.attributes = {
            "name":name,
            "age":age,
            "race":race,
            "profession":profession,
        }
        self.attrs = ["name", "age", "race", "profession"]
		
	def saveAttributes(self, charactor):
		fout = open('charactors/' + filename + '.actor', 'r') ## <- in my editor these have normal indentation :S
		lists = [self.attributes, self.attrs]
		pk.dump(lists)
		fout.close()
		
	def loadAttributes(self, charactor):
		fout = open('charactors/' + filename + '.actor', 'r')## <- in my editor these have normal indentation :S
		att = pk.load(fout)
		fout.close()
		return att
		
    def printAttrs(self):
        for item in self.attrs:
            print repr(self.attrs.index(item)) + ') ' + self.attributes[item]

    def changeAttr(self, attr, val):
        self.attributes[attr] = val

    def addAttr(self, attr, val):
        self.attributes[attr] = val
	

class Citizen(Actor):
	def __init__(self, name, age, race, profession, awesomeness):
		self.awesomeness = awesomeness
		Actor.__init__(self, name, age, race, profession)
		self.addAttr("awesomeness", self.awesomeness)
		
a_person = Citizen('a person', 15, 'human', 'assassin', 190999)
a_person.saveAttributes('person')

any help would be appreciated :)

i fixed it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.