I have python built into the application as a scripting platform, so users can write python scripts. I am trying to prevent imports, so they cannot be harmful in any way and must adhere to the API provided.
I came up with the following Python code:
__builtins__ .__import__= None reload = None
This prevents imports and prevents reloading of modules. Reboot prevention is required so that they cannot reload the built-in functions, giving them back working imports.
However, I am not a Python expert. Is there anything else that I am missing that the user can still import modules?
thanks
python scripting import
Alan macdonald
source share