By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,285 Members | 2,350 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,285 IT Pros & Developers. It's quick & easy.

Building a "safe" python?

P: n/a
I'm making a game where you'll be able to make your own mods and I
want to be able to write these mods in python. However, python has a
lot of "dangerous" functions (like erase any file on the harddrive
etc) so I want a "safe" python. I first found RExec but that is
disabled in python 2.5 so I was thinking about building python from
source with a few changes.
The changes I was thinking about was to change the import function so
that it should only be able to import the .pyd-files that I allow (and
it should of course still be able to import any .py-file) and remove
or change the builtin functions that are "dangerous".
Is this enough to make a "safe" python that can't do anything

I'm going to embed this "safe" python into my game and I've discovered
that when I embed the original python and the mod wants to import
a .py-file that is not in the game directory it will search for
the .py-file in the python directory that is installed on my computer.
Can I somehow prevent the embedded python to look in the python

Mar 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.