Try Python update

Mike Meyer mwm at mired.org
Sun Jan 1 19:32:07 EST 2006


"Devan L" <devlai at gmail.com> writes:
>> If you want to try an online P{ython tool that lets you save code, try
>> Devan L's at http://www.datamech.com/devan/trypython/trypython.py.
> My code uses one of the recipes from the Python Cookbook, 7.6 Pickling
> Code Objects. It's limited to closures though, just like in the recipe.
> So uh, you can't write closures in mine.

I don't have the dead trees version, and the online version doesn't
have chapter numbers. Is that <URL:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/212565>?

> On a side note, my brother has tinkered with the C internals and now
> __subclasses__ is restricted and many, many os and posix commands are
> restricted (not that you can get them anyways, since importing is
> broken!)

I got import to work by pickling pairs of names - the variable name
that references the module, and the name of the module. When it
unpickles the list, it reimports them and points the appropriate
variable at them. This had unwanted effects if you did an "import
this". It also doesn't work for objects that contain references to
modules.

I tried for a bit to restrict things, then gave up and did it
externally. There's no access to any files but those required to run
the script that deals with thing, and some other python modules that I
decided would be nice to have. Normally, nothing in the tree is
writable, either. Once I'm happy with it, I'll save a copy of the tree
somewhere and set up a cron job to "refresh" it at regular intervals.

          <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list