Orange Forum • View topic - problem pickling and unplicking ExampleTable

problem pickling and unplicking ExampleTable

Report bugs (or imagined bugs).
(Archived/read-only, please use our ticketing system for reporting bugs and their discussion.)
Forum rules
Archived/read-only, please use our ticketing system for reporting bugs and their discussion.

problem pickling and unplicking ExampleTable

Postby aonlazio » Sun Nov 15, 2009 19:09

Hi,
For some reason, it happened to some ExampleTable objects, that is, when I pickle ExampleTable using

data_string = MySQLdb.escape_string(cPickle.dumps(data_object,2))

And then later I closed the Python Interpreter and then opened again
I unpickle it using

data_retrieve = cPickle.loads(data_string)
data_retrive.save('test.tab')

It appeared in file test.tab the class "#RNGE" at which I had no idea where that came from. Note that it happened to some ExampleTable objects, not all of them though..
Could somebody explain this please..

Thanks in advance

Postby eliasz » Wed Mar 24, 2010 14:51

I'm getting similar error while pickling two decision trees (from TreeLearner) and unpickling them. The result depends on the order of unpickling (!) -- if i unpickle another tree first, the second one gets corrupted (with #RNGE class vars in its nodes). When unpickling the second tree alone, everything seems ok (my case: http://www.ailab.si/orange/forum/viewtopic.php?t=880).

Do you unpickle other things before the offending table?

The #RNGE value comes from source/orange/vars.cpp, it seems that enum variable value is out of expected range.

Code: Select all
// Converts TValue into a string representation of value. If invalid, string 'ERR' is returned.
void TEnumVariable::val2str(const TValue &val, string &str) const
{ if (val.isSpecial()) {
    special2str(val, str);
    return;
  }

  if (val.svalV) {
    const TDiscDistribution *dval = dynamic_cast<const TDiscDistribution *>(val.svalV.getUnwrappedPtr());
    if (!dval)
      raiseError("invalid value type");

    str = "(";
    char buf[12];
    const_PITERATE(TDiscDistribution, di, dval) {
      if (di != dval->begin())
        str+=", ";
      sprintf(buf, "%1.3f", *di);
      str += buf;
    }
    str += ")";
  }

  str = val.intV<int(values->size()) ? values->operator[](val.intV) : "#RNGE";
}


Return to Bugs