[wingide-users] Pickling modules with `copy_reg`

cool-RR cool-rr at cool-rr.com
Fri Apr 16 10:18:07 MDT 2010

I am trying to use the `copy_reg` module to teach the pickle module how to
pickle modules:

def reduce_module(module):
    return (__import__, (module.__name__, {}, {}, ['']))

copy_reg.pickle(types.ModuleType, reduce_module)

This works when I run it normally, but when I run it under debug in Wing, I

'''pickle.PicklingError: Can't pickle <built-in function
wingdb_import_hook>: it's not found as tdbgtracer26.wingdb_import_hook'''

I think what happens is that Python is able to pickle `__import__`, but not
the hook that replaces it in the debugger.

What should I do?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/wingide-users/attachments/20100416/00c3f46c/attachment.html

More information about the wingide-users mailing list