Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35612

Re: pickle module doens't work

Newsgroups comp.lang.python
Date 2012-12-27 04:05 -0800
References <ee10f0f7-7713-4879-82a1-ec5804767af6@googlegroups.com> <mailman.1339.1356607732.29569.python-list@python.org>
Subject Re: pickle module doens't work
From Omer Korat <animus.partum.universum@gmail.com>
Message-ID <mailman.1340.1356609912.29569.python-list@python.org> (permalink)

Show all headers | View raw


You're probably right in general, for me the 3.3 and 2.7 pickles definitely don't work the same:

3.3:
>>> type(pickle.dumps(1))
<type 'bytes'>

2.7:
>>> type(pickle.dumps(1, pickle.HIGHEST_PROTOCOL))
<type 'str'>


As you can see, in 2.7 when I try to dump something, I get useless string. Look what I gen when I dump an NLTK object such as the sent_tokenize function:

'\x80\x02cnltk.tokenize\nsent_tokenize\ng\x00'

Now, this is useless. If I try to load it on a platform without NLTK installed on it, I get:

ImportError: No module named 'nltk'

So it means the actual sent_tokenizer wasn't saved. Just it's module.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2012-12-27 02:46 -0800
  Re: pickle module doens't work Peter Otten <__peter__@web.de> - 2012-12-27 12:29 +0100
    Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2012-12-27 04:05 -0800
      Re: pickle module doens't work Dave Angel <d@davea.name> - 2012-12-27 07:34 -0500
        Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2012-12-27 05:16 -0800
          Re: pickle module doens't work Chris Angelico <rosuav@gmail.com> - 2012-12-28 00:20 +1100
        Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2012-12-27 05:16 -0800
          Re: pickle module doens't work Tim Roberts <timr@probo.com> - 2012-12-28 21:41 -0800
            Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2013-01-01 06:33 -0800
              Re: pickle module doens't work Tim Roberts <timr@probo.com> - 2013-01-01 11:14 -0800
                Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2013-01-02 06:08 -0800
      Re: pickle module doens't work Terry Reedy <tjreedy@udel.edu> - 2012-12-27 16:19 -0500
    Re: pickle module doens't work Omer Korat <animus.partum.universum@gmail.com> - 2012-12-27 04:05 -0800

csiph-web