Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60397

Re: Excute script only from another file

From Dave Angel <davea@davea.name>
Subject Re: Excute script only from another file
Date 2013-11-24 22:20 -0500
References <989ee1b9-141a-4cb3-a9a2-f1527c0d0db3@googlegroups.com> <989ee1b9-141a-4cb3-a9a2-f1527c0d0db3@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.3157.1385349595.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, 24 Nov 2013 17:55:08 -0800 (PST), Himanshu Garg 
<hgarg.india@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Excute script only from another file Himanshu Garg <hgarg.india@gmail.com> - 2013-11-24 17:55 -0800
  Re: Excute script only from another file Chris Angelico <rosuav@gmail.com> - 2013-11-25 14:15 +1100
  Re: Excute script only from another file Dave Angel <davea@davea.name> - 2013-11-24 22:20 -0500
    Re: Excute script only from another file Larry Hudson <orgnut@yahoo.com> - 2013-11-26 00:10 -0800
  Re: Excute script only from another file Michael Torrie <torriem@gmail.com> - 2013-11-24 19:58 -0700
  Re: Excute script only from another file Peter Otten <__peter__@web.de> - 2013-11-25 09:12 +0100
  Re: Excute script only from another file Himanshu Garg <hgarg.india@gmail.com> - 2013-11-25 02:52 -0800
    Re: Excute script only from another file Dave Angel <davea@davea.name> - 2013-11-25 07:16 -0500
    Re: Excute script only from another file Rick Johnson <rantingrickjohnson@gmail.com> - 2013-11-25 18:28 -0800
      Re: Excute script only from another file Chris Angelico <rosuav@gmail.com> - 2013-11-26 13:41 +1100
        Re: Excute script only from another file Rick Johnson <rantingrickjohnson@gmail.com> - 2013-11-25 19:45 -0800
      Re: Excute script only from another file Steven D'Aprano <steve@pearwood.info> - 2013-11-26 03:09 +0000
      Re: Excute script only from another file Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-26 12:25 -0500
      Re: Excute script only from another file Chris Angelico <rosuav@gmail.com> - 2013-11-27 10:09 +1100
        Re: Excute script only from another file Rick Johnson <rantingrickjohnson@gmail.com> - 2013-11-26 17:56 -0800
          Re: Excute script only from another file Chris Angelico <rosuav@gmail.com> - 2013-11-27 13:39 +1100

csiph-web