Name
r_import, s_import
Synopsis
r
.r_import(modname
[,globals
[,locals
[,fromlist
]]])r
.s_import(modname
[,globals
[,locals
[,fromlist
]]])
Imports the module modname
into the
restricted environment. All parameters are just like for built-in
function __import__
, covered in Chapter 7. r_import
raises
ImportError
if the module is considered unsafe. A
subclass of RExec
may override
r_import
, to change the set of modules available
to import
statements in untrusted code and/or to
otherwise change import
functionality for the
sandbox.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.