David wrote:

but when I change it to;
start_total()
start = start_total()
a = Account(start)

here is the error;
Enter Amount: 100
Traceback (most recent call last):
  File "./py_pettycash.py", line 77, in <module>
    menu()
  File "./py_pettycash.py", line 53, in menu
    a.deposit(cash)
  File "./py_pettycash.py", line 15, in deposit
    self.balance = self.balance + amt
TypeError: unsupported operand type(s) for +: 'NoneType' and 'Decimal'

-david


Ok I got it, same problem I had before no return :)

def start_total():
    fname = open("cash.dat", "r")
    contents = cPickle.Unpickler(fname)
    data = contents.load()
    print "The current balance is", data
    fname.close()
    return data

start = start_total()
a = Account(start)

Thanks all, any other comments?, I am going to add some error checking but, I am so happy, woopee

-david

--
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com
pgp.mit.edu

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to