problem with pickle - Python

This is a discussion on problem with pickle - Python ; hello everybody I've just started learning python . i stumbled upon this broad spectrum function 'pickle' but it is not getting executed as it should this is what the python interpreter returns on giving the basic command >>>pickle.dump(x,f) where x ...

+ Reply to Thread
Results 1 to 2 of 2

problem with pickle

  1. Default problem with pickle

    hello everybody
    I've just started learning python . i stumbled upon this broad
    spectrum function 'pickle'

    but it is not getting executed as it should

    this is what the python interpreter returns on giving the basic
    command

    >>>pickle.dump(x,f) where x is a tuple and f is a file object


    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    NameError: name 'pickle' is not defined

    kindly elucidate what's wrong

    thanks


  2. Default Re: problem with pickle

    K Gaur <gaurkuber> wrote:
    > this is what the python interpreter returns on giving the basic
    > command
    >
    > >>>pickle.dump(x,f) where x is a tuple and f is a file object

    >
    > Traceback (most recent call last):
    > File "<stdin>", line 1, in ?
    > NameError: name 'pickle' is not defined
    >
    > kindly elucidate what's wrong



    You should import the module in the local namespace before using it:

    >>> import pickle
    >>> pickle.dump


    --
    Lawrence, oluyede.org - neropercaso.it
    "It is difficult to get a man to understand
    something when his salary depends on not
    understanding it" - Upton Sinclair

+ Reply to Thread

Similar Threads

  1. marshal vs pickle
    By Application Development in forum Python
    Replies: 15
    Last Post: 11-02-2007, 02:36 PM
  2. Re: marshal vs pickle
    By Application Development in forum Python
    Replies: 0
    Last Post: 11-01-2007, 04:34 PM
  3. Re: marshal vs pickle
    By Application Development in forum Python
    Replies: 0
    Last Post: 11-01-2007, 03:59 PM
  4. pickle and __slots__
    By Application Development in forum Python
    Replies: 3
    Last Post: 10-04-2007, 12:27 PM
  5. ValueError: insecure string pickle ?
    By Application Development in forum Python
    Replies: 2
    Last Post: 09-11-2007, 01:51 PM