AttributeError: 'module' object has no attribute 'newperson'
<p>I am currently learning python programming (and am a beginner at it). Currently I am stuck on files exercises (so these are set things I need to do, rather than doing whatever I want. Unfortunately, it also means I probably can't do any complicated (for me) shortcuts)</p>

<p>Currently using Python 3.2.2</p>

<p>I need two different programs. One is to input what the user types in (a name and a DOB) and put that into records in a list and write that into a binary file. The other is to read that file and print that into a table using padding.</p>

<p>Codes:</p>

<p>First</p>

<pre><code>    import pickle

class newperson():
    def __init__(self):
        self.name = ""
        self.dob = ""

stop = False
people = []
print("When you want to stop just hit enter")
count = 0

while stop == False:
    name = input("Please Enter the name: ")
    if len(name) == 0:
        stop = True
    else:
        people.append(newperson())
        people[count].name = name
        people[count].dob = input("Please enter their DOB: ")
        count = count + 1

file = open("ex9.4.dat", "wb")
pickle.dump(people,file)
file.close()
</code></pre>

<p>Second:</p>

<pre><code>import pickle

myfile = open("ex9.4.dat", "rb")

people = pickle.load(myfile)

print("{0:&lt;15}{1}".format("Name","DOB"))
for item in people:
    print("{0:&lt;15}{1}".format(item.name,item.dob))
</code></pre>

<p>The problem is that I am getting the following error when trying to run the 2nd program:</p>

<pre><code>AttributeError: 'module' object has no attribute 'newperson'
</code></pre>

<p>on</p>

<pre><code>    people = pickle.load(myfile)
</code></pre>

<p>Unfortunately, when I have looked for answers on the other questions, either none of the solutions have worked, don't apply to me or mostly just went WAAAY over my head.</p>

<p>What am I doing wrong?</p>

<p>Thanks in advance for the help.</p>
