tags:

views:

37

answers:

1

Hi !

I was wondering if it was possible to import a library in python, and completely change its name.

say i need to do :

import plop.blah.wii

but I want it to be recognized as foo.bar.yeah

something like

import plop.blah.wii as foo.bar.yeah

Any idea how can this be done ? When unpickling an object, Python expects a library that I have under plop.blah.wii, and I can't change that name .. but the pickle wants it to be foo.bar.yeah .

Thanks a lot for your help. Sorry for the confusion. It's been confusing me for a while now ..

Martin

+2  A: 

Rather than aliasing the module, there's a way to more directly solve your problem. You can override the method used by the pickler to resolve globals to map the old module name to the new module name. The details are here.

Geoff Reedy
This sounds like just what I need =) Will let you know how it goes. Thanks a lot Geoff.
Martin