[IPython-User] ipython parallelism returning user-defined types

John Reid j.reid@mail.cryst.bbk.ac...
Fri Nov 12 11:51:24 CST 2010

On 10/11/10 21:39, Brian Granger wrote:
>      >
>      > Hmm, that is an odd error that I have never seen.  Even the fact
>     that it is a
>      > TypeError is odd to me.  A couple of things to look at:
>      >
>      > * Make sure that named tuples can be pickled and unpickled.
>     namedtuple objects can be pickled, but you have to be particularly
>     careful.
>     Creating a namedtuple type at the prompt and then trying to send
>     that over won't
>     work because the type won't be available on the other side.
>     IPython's FakeModule
>     will cause more complications. Creating a namedtuple type inside of
>     a function
>     is even worse since the pickle cannot address it by name. If you
>     create the
>     namedtuple type in a real module that is available to both
>     interpreters, it will
>     probably work.
> Robert makes good points.  You do have to make sure types are in modules
> when using IPython.  I would put namedtuple in a module, and then make
> sure you import that module in both the client and engine namespaces.
Yup, I think I had avoided these pitfalls but there was still the 
TypeError. I imagine it is something to do with the recipe from the 
activestate python cookbook. In any case the collections.namedtuple in 
python 2.6 is working just fine.


More information about the IPython-User mailing list