Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'anyway.': 0.05; 'interpreter': 0.05; 'executable': 0.09; 'rewrite': 0.09; 'python': 0.11; '"python': 0.16; '(assuming': 0.16; '.py': 0.16; 'args.': 0.16; 'specifying': 0.16; 'subject:python': 0.16; 'followed': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'command': 0.22; 'example': 0.22; 'portion': 0.22; 'separate': 0.22; 'header:User-Agent:1': 0.23; '(by': 0.24; 'received:emailsrvr.com': 0.24; "i've": 0.25; 'script': 0.25; 'received:(smtp server)': 0.26; 'header:In-Reply-To:1': 0.27; 'installed': 0.27; 'am,': 0.29; 'included': 0.31; 'usually': 0.31; 'fine,': 0.31; 'gary': 0.31; 'invoke': 0.31; 'run': 0.32; 'really': 0.36; 'doing': 0.36; 'should': 0.36; 'to:addr:python- list': 0.38; 'anything': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'remove': 0.60; 'simply': 0.61; "you're": 0.61; 'name': 0.63; 'line,': 0.68; 'etc),': 0.84; 'received:108.166': 0.84; 'ware': 0.91; 'received:108': 0.93 X-Virus-Scanned: OK Date: Thu, 20 Mar 2014 10:45:33 -0700 From: Gary Herron User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: running python 2 vs 3 References: <87ob10nbeh.fsf@elektro.pacujo.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395337900 news.xs4all.nl 2953 [2001:888:2000:d::a6]:40462 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68594 On 03/20/2014 10:10 AM, notbob wrote: > On 2014-03-20, Zachary Ware wrote: > >> If you're specifying the interpreter in your command (by calling >> "python .py", etc), the shebang won't mean anything >> anyway. > DOH! > > I was following you, fine, until that last sentence. Then how should > I invoke the scripts? ....as your example is exactly how I've been > doing it with 2.7, as per Learn Python the Hard Way. Simply > ./.py from the appropriate directory (assuming I keep both > vers in separate dirs)? > > nb If you mark your script as executable (chmod ...) and include the shebang line, and place it in a directory included in your search path (mine is ~/bin), then you run it as you run any installed program: Just type it's name followed by any command line args. I usually remove the .py portion of the name as I copy it into my bin directory so it really does look like any other installed program. If you need to be in a specific directory when you run it, then perhaps you should consider a bit of a rewrite to remove this constraint. Gary Herron