Allan Tanaka via Tutor wrote:

> 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

Why not just

import pickle

?

> def load_cPickle(filename):
>     with open(filename) as f:
> 
>         return cPickle.load(f)

I've no idea what your code is supposed to do, and my attempt to run it 
didn't get this far -- but you have to open the file in binary mode

with open(filename, "rb") as f: ...

to load the pickled data.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to