Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'output': 0.05; 'that?': 0.05; 'paths': 0.07; 'subject:file': 0.07; 'executable': 0.09; 'filenames': 0.09; 'sake': 0.09; 'runs': 0.10; 'python': 0.11; '(named': 0.16; '>the': 0.16; 'answers:': 0.16; 'example).': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'simpson': 0.16; 'solver.': 0.16; 'somehow.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'command': 0.22; 'example': 0.22; 'shell': 0.22; 'header:User-Agent:1': 0.23; 'certainly': 0.24; 'subject: .': 0.24; 'cheers,': 0.24; 'script': 0.25; 'this:': 0.26; 'second': 0.26; 'header:In-Reply-To:1': 0.27; "i'm": 0.30; 'explained': 0.31; 'feeds': 0.31; 'file': 0.32; "we're": 0.32; 'run': 0.32; 'skip:d 20': 0.34; 'subject:the': 0.34; 'but': 0.35; 'there': 0.35; 'skip:> 10': 0.36; 'charset:us- ascii': 0.36; 'so,': 0.37; 'two': 0.37; 'problems': 0.38; 'to:addr :python-list': 0.38; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'hope': 0.61; 'first': 0.61; 'back': 0.62; 'content-disposition:inline': 0.62; 'email addr:gmail.com': 0.63; 'myself': 0.63; 'skip:n 10': 0.64; 'fashion': 0.64; 'forward': 0.65; 'here': 0.66; 'yes': 0.68; 'hour': 0.70; 'fire!': 0.84; 'received:192.168.15': 0.84 Date: Tue, 27 Jan 2015 09:35:03 +1100 From: Cameron Simpson To: python-list@python.org Subject: Re: Running a .py file iteratively at the terminal MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <6e21583e-8c62-413f-b54a-1e7ffaab9fd4@googlegroups.com> User-Agent: Mutt/1.5.23 (2014-03-12) References: <6e21583e-8c62-413f-b54a-1e7ffaab9fd4@googlegroups.com> 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422311715 news.xs4all.nl 2975 [2001:888:2000:d::a6]:57791 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84622 On 26Jan2015 13:10, varun7rs@gmail.com wrote: >Thanks a lot Mark but that would be a bit trivial. How can I run the same file multiple times? Or if I need to run two commands: >srva@hades:~$ python NFV_nw_eu_v3_14_1_15.py --output eu_v3_14_1_15 --demand demands_v3_21_1_15.xml --xml nobel-eu.xml >srva@hades:~$ python NFV_v3_7_10_14.py -l log --lp --xml eu_v3_14_1_15.xml > >repeatedly, how can I do that? Can I write a script to perform this function?If so, can you please help me with it? >The first command generates an output file eu_v3 and the second file feeds it to the solver. This is what I intend to do multiple times. I hope I have explained it this time in a much better way. I'm sorry English is my second language and I have some problems in expressing myself at times. Certainly you can script it. Write a tiny shell script (named "mygensolve.sh" for the sake of example). Example (untested): #!/bin/sh python NFV_nw_eu_v3_14_1_15.py --output eu_v3_14_1_15 --demand demands_v3_21_1_15.xml --xml nobel-eu.xml python NFV_v3_7_10_14.py -l log --lp --xml eu_v3_14_1_15.xml Either make it executable ("chmod +rx mygensolve.sh") and run it like this: ./mygensolve.sh or don't bother, and run it in an analogous fashion to your python commands: sh mygensolve.sh There are multiple paths forward from here if you have many runs with filenames which can be enurated somehow. Cheers, Cameron Simpson The top three answers: Yes I *am* going to a fire! Oh! We're using *kilometers* per hour now. I have to go that fast to get back to my own time. - Peter Harper