On Mon, 25 Nov 2013 18:28:42 -0800, Rick Johnson wrote: > On Monday, November 25, 2013 4:52:46 AM UTC-6, Himanshu Garg wrote: > >> My motive is "I will give scripts to somebody else and he should not >> run the script directly without running the parent script". > > The only sure fire method to prevent a file containing Python code from > executing on a machine with Python installed is to [snip bad advice]
... is to delete Python from the system, or the Python code. Or both. If Python can read a file, it can exec it. I suppose you could use file permissions and ACLs to prevent Python from reading the file, rather than delete it, but given the possibility of privilege-escalation security vulnerabilities, even that's not sure-fire. -- Steven -- https://mail.python.org/mailman/listinfo/python-list