[Tutor] Engarde program was: i++

Danny Yoo dyoo at cs.wpi.edu
Wed Jun 6 22:12:14 CEST 2007



On Wed, 6 Jun 2007, scott wrote:

> Danny Yoo wrote:
>>  In the context of the new Master_stats class, it makes more sense for
>>  mfile_read() to return a Master_stats object now rather than a two-tuple
>>  list.
> I was able to change the [year, month] to just master and it worked fine.  I 
> was also able to do master = mfile_read() and it worked fine as well.

Hi Scott,


Double check the definition of mfile_read().  It has a possible type error 
in terms of the values it returns back to the user.

#####################################################################
def mfile_read():
     '''This will open the master file and load all the variables'''
     try:
         mfile = open("./Master/mfile", "r")
     except:
         mfile = open("./Master/mfile", "w")
         mfile.close()
         print "File could not be opened, so I created one"
         return [1631, 8]

     master = cPickle.load(mfile)
     mfile.close()
     return master
#####################################################################


More information about the Tutor mailing list