Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'scripts': 0.03; 'subject:file': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:script': 0.09; 'garg': 0.16; 'invoking': 0.16; 'maliciously': 0.16; 'naming': 0.16; 'rationale': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'header:User-Agent:1': 0.23; 'directory.': 0.24; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'accidentally': 0.31; 'obscure': 0.31; 'probably': 0.32; 'subject:from': 0.34; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'like,': 0.36; 'doing': 0.36; 'should': 0.36; 'two': 0.37; 'nov': 0.38; 'to:addr:python-list': 0.38; 'explain': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'name': 0.63; 'yourself': 0.78; 'protect': 0.79; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: Excute script only from another file Date: Sun, 24 Nov 2013 22:20:21 -0500 References: <989ee1b9-141a-4cb3-a9a2-f1527c0d0db3@googlegroups.com> <989ee1b9-141a-4cb3-a9a2-f1527c0d0db3@googlegroups.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 174.32.174.29 In-Reply-To: <989ee1b9-141a-4cb3-a9a2-f1527c0d0db3@googlegroups.com> User-Agent: Groundhog Newsreader for Android X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385349595 news.xs4all.nl 15987 [2001:888:2000:d::a6]:48834 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60397 On Sun, 24 Nov 2013 17:55:08 -0800 (PST), Himanshu Garg 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