[docs] problem using pickle

Andres Soto andres.soto.v at gmail.com
Fri Oct 25 10:39:25 CEST 2013


Hi,
I am trying to save a Naive Bayes classifier with cPickle (as it says in
NLTK: Storing Taggers http://nltk.org/book/ch05.html), but I got an error.
These are the function code I used to save/load it:

import cPickle as cp

def salva_fichC(fich1,data):
    fich=fich1+'.dmp'
    f = open(fich, 'wb')
    cp.dump(data, f,-1)
    f.close()

def carga_fichC(fich1):
    fich=fich1+'.dmp'
    f = open(fich, 'rb')
    data = cp.load(f)
    f.close()
    return data

I have tried also with pickle, with and without -1 in dump
Can you help me? Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20131025/9cf10976/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Captura de pantalla 2013-10-25 a la(s) 10.30.50.png
Type: image/png
Size: 33588 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/docs/attachments/20131025/9cf10976/attachment-0001.png>


More information about the docs mailing list