Serializing functions

Paul Rubin no.email at nospam.invalid
Thu Jun 17 10:37:36 EDT 2010


Matteo Landi <landimatte at gmail.com> writes:
> If you try and pickle a function, it is not pickled as a whole,
> indeed, once you unpickle it, it will raise an exception telling you
> that the target function was not found in the current module.
>
> So I'm here, with nothing in my hands; how would you implement this?

Use marshal rather than pickle.  Note that requires both ends to be
running the same python version.  Be aware of the obvious security
issues of running code that came from remote machine, either because the
remote machine itself may be untrusted or compromised, or because the
network between the two machines may be compromised (remote machine is
being spoofed or commnications are being modified).



More information about the Python-list mailing list