def read_month_data( month , year , commodity ): rtn = MonthData( month , year ) dir = "price_data/" + str( year ) + " " + DateUtils.format_month( month ) try : file = open( dir + "/" + commodity + ".csv" , "r" ) lines = file.readlines() for line in lines : datapoint = DataPoint.from_csv_month_data( year , month , line ) rtn.set( int( datapoint.get_day() ) , datapoint ) except IOError: #there is no data, so ignore the error and return default #values of 0 for daily and average prices pass return rtn