How to permanently remove __import__?

Moshe Zadka m at
Wed Jun 18 20:01:26 CEST 2003

On Wed, 18 Jun 2003, "martin z" <pxtl at> wrote:

> This is what I meant by "too much".  I have no ambiguous concept of
> "potentially dangerous code" - I just don't want
> the user getting at the files.

Then use your operating system's capabilities for restricted execution.
Alternatively, look at the code Oren Tirosh posted a few days ago
to show how it's fairly easy to break this type of restrictions.

Importing is your *last* problem. 
(For starters, you want to make sure you properly disable open()
and file() and execfile(), right? And trust all builtin modules to
be fairly nice...and trust the Python coders to make sure no
untrusted paths exist...)
Moshe Zadka --
Buffy: I don't like you hanging out with someone that... short.
Riley: Yeah, a lot of young people nowadays are experimenting with shortness.
Agile Programming Language --

More information about the Python-list mailing list