0

I'm trying to save a Python Object, version 3.6, using Pickle.

I followed this guide: Saving an Object (Data persistence) and I got this message "RecursionError: maximum recursion depth exceeded while calling a Python object"

So I read this "Hitting Maximum Recursion Depth Using Pickle / cPickle" typing this:

import sys
sys.setrecursionlimit(3000)

import pickle
with open('Results_AL.pkl','wb') as output:

    pickle.dump(Results_AL,output)

And nothing, I get the same error. I tried to increase the "setrecursionlimit" until I got this error "Kernel died, restarting".

The Results_AL contains a series of tables, that were read from an html file. Is there a kind of limit or an object type I can not save with Pickle? Is there a way to check if I can use Pickle with my object?

I add some details:

Please consider I'm new with Python so feel free to advise me an alternative way. I defined I class just to store my output that I read from an html file. This file comes from an energy simulation with EnergyPlus, I used the "eppy" library to read it. So this is the code:

class Res:
def __init__(self):
    self.Tab1=[]
    self.Tab2=[]
    self.Tab3=[]


Results=Res()   
filepath=path+'myfile.htm'
filetable = open(filepath, 'r').read() 
tablelist = readhtml.titletable(filetable)
titles = [i[0] for i in tablelist]
Results.Tab1=tablelist[titles=='End Uses']

Here is the link for eppy http://pythonhosted.org/eppy/Outputs_Tutorial.html

scana
  • 111
  • 1
  • 11
  • 4
    The code which created `Results_AL` would be of more interest – Michael Butscher Dec 01 '17 at 12:23
  • 2
    Saying `Results_AL` contains a series of tables is to vague because "tables" aren't a built-in data-type (or at least that's not a common name of any of them), so we need a more detailed description (and probably the code, too) that creates of whatever is in `Results_AL` because that's where the problem likely arises. – martineau Dec 01 '17 at 12:41
  • Yes you are right. I added some details. Can I attach the html file? – scana Dec 01 '17 at 13:20

0 Answers0