pickle

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jenya56
    New Member
    • Nov 2009
    • 14

    pickle

    Dear all,
    I have the following error:
    "CPickle.dump(l oclist,fout) Memory Error". This error occurs when I am trying to use the function "Locations_to_f ile" (see below) as I think my object loclist is too big.
    Code:
        def Locations_to_file(loclist,fname):
              '''Routine to help write a list of location objects to a file'''
              try:
                fount = open(fname,"wb")
                cPickle.dump(loclist,fout)  # this is the line it complains about
                fout.close()
              except IOError, e:
                  raise(e)
        #Locations_to file
    Any suggestions please. Thanks.
    Last edited by bvdet; Dec 22 '09, 03:42 PM. Reason: Add code tags
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Please use code tags when posting code. See posting guidelines here.

    It's hard to say what your problem is without knowing what loclist is. Some objects just won't pickle. I don't understand pickle enough to suggest a possble problem without knowing more.

    Comment

    • Glenton
      Recognized Expert Contributor
      • Nov 2008
      • 391

      #3
      I suppose it's not as simple as changing fount -> fout in your code? Otherwise let us know about loclist - doubt that size is an issue.

      Comment

      Working...