Hi I have added b so that it translates into bytes object. save_cPickle part is not problem... But i still get an error when coming into load_cPickle for this function: Dataset.save_part_features('categorical_counts', Dataset.get_part_features('categorical')) although i have defined b in save_cPickle
THE CODE: import _pickle as cPickle def save_cPickle(filename, data): with open(filename, 'wb') as f: cPickle.dump(data, f) def load_cPickle(filename): with open(filename) as f: return cPickle.load(f) class Dataset(object): part_types = { 'id': 'd1', 'loss': 'd1', } parts = part_types.keys() @classmethod def save_part_features(cls, part_name, features): save_cPickle('%s/%s-features.pickle' % (cache_dir, part_name), features) @classmethod def get_part_features(cls, part_name): return load_cPickle('%s/%s-features.pickle' % (cache_dir, part_name)) Dataset.save_part_features('categorical_counts', Dataset.get_part_features('categorical')) Dataset(categorical_counts=train_cat_counts).save('train') _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor