Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'nicely': 0.07; 'python3': 0.07; 'indicates': 0.09; 'skip:/ 10': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '2.7': 0.14; '(within': 0.16; '.py': 0.16; 'cc:name:python list': 0.16; 'formerly': 0.16; 'years)': 0.16; 'subject:python': 0.16; 'files.': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'thu,': 0.19; 'cc:addr:python.org': 0.22; '2.x': 0.24; 'initial': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'script': 0.25; 'tutorials': 0.26; 'header:In-Reply-To:1': 0.27; 'installed': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'run': 0.32; 'linux': 0.33; 'skip:# 10': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'idle': 0.36; 'convention': 0.38; 'how': 0.40; 'tell': 0.60; 'till': 0.61; 'visa': 0.61; 'box,': 0.64; 'different': 0.65; 'fire': 0.65; 'between': 0.67; 'mar': 0.68; '20,': 0.68; 'default': 0.69; '2.7.': 0.84; 'actually,': 0.84; 'env': 0.84; 'trick.': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=rArwqdn52n1pQ0wFWrIwZhKgJdXSMVmK7F7zO5HTx40=; b=IOZkWSFOx919LW8Fag9l9k28cqUWr/gQ0dylHwO/DlGBaMktaUkEOsMh3arG8PsCTO GNqQzFq00neZCFBm6xnWEF24Ugq+vHUh4uTDpdsZ8k5UPWN4tC5IZzLXYkK8DNPyRodM tLpHYeoFTlWWdnfkfK9gtmGhohyqpdE33r2AQOEjP/URvXL0gKXzHggSkZRilvBUwd4x ixOPKVQ8wPNfxCQpPAAGKiRd27S2Xfg6+/w0ZNrje6n0xjcXtgWEPgmfQpT9sYRgMR/H Vs8x3pKXqJwJKcZgdjU2qhs4kLImUvGi/7+myUVx5PGg/hrEv+3KMAgS9NaaXgrCf/Ji NKZw== MIME-Version: 1.0 X-Received: by 10.236.96.201 with SMTP id r49mr61991391yhf.33.1395347891044; Thu, 20 Mar 2014 13:38:11 -0700 (PDT) In-Reply-To: <87ob10nbeh.fsf@elektro.pacujo.net> References: <87ob10nbeh.fsf@elektro.pacujo.net> Date: Thu, 20 Mar 2014 13:38:10 -0700 Subject: Re: running python 2 vs 3 From: Dan Stromberg To: Marko Rauhamaa Content-Type: text/plain; charset=ISO-8859-1 Cc: Python List 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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395347900 news.xs4all.nl 2961 [2001:888:2000:d::a6]:52277 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68614 On Thu, Mar 20, 2014 at 8:21 AM, Marko Rauhamaa wrote: > notbob : > >> I've installed python 3.3 on my Slack box, which by default comes with >> python 2.7. I know how to fire up the different IDLE environments, but >> how do I differentiate between the scripts? IOW, up till now, I've >> used .py on all my 2.7 files. How do I know not to run a .py in >> python3 or visa versa? Or do I? What's the excepted convention for >> differentiating between the two? > > That's a bit of a sore spot. > > On a linux box, the initial line of the script indicates the > interpreter: > > #!/usr/bin/env python2 > > for Python 2.x > > #!/usr/bin/env python3 > > for Python 3.x. > > All tutorials will tell you to start it with > > #!/usr/bin/env python Actually, I formerly used /usr/bin/env, but have recently (within the last couple of years) stopped. This is because the env trick doesn't play nicely with top IME. Also, it's a trick.