[IPython-dev] ipython1 saw exception transport and raising

Brian Granger ellisonbg.net@gmail....
Thu Jul 12 21:51:04 CDT 2007


Can you do an svn up and try again.  You patch made it pretty clear
what the problem was.  However, I did make some changes to make sure
that the new type and value are something other than a string.  Here
is what I committed:

def packageFailure(f):
    """Clean and pickle a failure preappending the string FAILURE:"""

    # This is sometimes helpful in debugging
        pString = pickle.dumps(f, 2)
    except pickle.PicklingError:
        # Certain types of exceptions are not pickleable, for instance ones
        # from Boost.Python.  We try to wrap them in something that is
        f.type = UnpickleableException
        f.value = UnpickleableException(str(f.type) + ": " + str(f.value))
        pString = pickle.dumps(f, 2)
    return 'FAILURE:' + pString

Let me know how this works - I don't have Boost.Python installed so I
can't reproduce your situation exactly.  I can modify it further if


On 7/9/07, Doug Jones <dfj225@gmail.com> wrote:
> Hello IPython devs,
> I've been testing the ipython1 saw branch and was testing some of the
> new exception handling code. All in all, it seems to be working very
> well, but I have come across one quirk that affects my code. Part of
> the system that I use involves C++ code wrapped using Boost.Python.
> For some reason, it seems that Boost.Python likes to create its own
> classes for exceptions which aren't able to be pickled. So, whenever
> one of these exceptions gets generated, I get a traceback about failed
> pickling instead of the actual error that was generated.
> I cooked up a little change that makes these types of errors able to
> be serialized. I'm not too familiar with the internals of IPython1, so
> there might be a much better way to do this, but at the very least I
> hope my code serves as a good indication of where the problem lies.
> Thanks,
> ~doug
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev

More information about the IPython-dev mailing list