Excute script only from another file
Dave Angel
davea at davea.name
Sun Nov 24 22:20:21 EST 2013
On Sun, 24 Nov 2013 17:55:08 -0800 (PST), Himanshu Garg
<hgarg.india at gmail.com> wrote:
> Like, I have two scripts "scrip1.py" and "script2.py" and there is
a line in "script1.py" to call "script2.py" as
subprocess.call(["python", "script2.py"]).
> Then this is should call script2 but I should not be able to
directly call script2 as $python script2.py
Are you really trying to protect against yourself accidentally
invoking it or someone maliciously doing it?
I would probably give scrpt2 an obnoxious name like
htrerttcdrrthyyh.py or put it in an obscure directory. But if you
explain the rationale we might come up with something better.
How about naming it dontrunme.py ?
--
DaveA
More information about the Python-list
mailing list