开发者

Need to clear import/module path for python interpreter

开发者 https://www.devze.com 2023-03-10 14:47 出处:网络
I need a unix terminal command that will boot a python interpreter without giving it access to import anything. I am aware that you can import os, and then change that path, but this would be counter

I need a unix terminal command that will boot a python interpreter without giving it access to import anything. I am aware that you can import os, and then change that path, but this would be counter productive, so I need to do it either on Python startup, or without importing anything in the python interprete开发者_运维知识库r.


Python does not have robust support for running untrusted code, but for a reasonable approximation, you can try this blog post. A more robust alternative would be to use Lua, JavaScript or TCL, all of which are carefully designed to run untrusted code in a crafted sandbox environment.

0

精彩评论

暂无评论...
验证码 换一张
取 消