Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(at': 0.04; 'output': 0.05; 'subject:getting': 0.07; 'sys': 0.07; 'advice.': 0.09; 'lines:': 0.09; 'mess': 0.09; 'trailing': 0.09; 'yeah,': 0.09; 'python': 0.11; 'gui': 0.12; '2.7': 0.14; 'windows': 0.15; '"python"': 0.16; "'a',": 0.16; "'b',": 0.16; '(windows': 0.16; '.py': 0.16; 'command,': 0.16; 'executed.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'grep': 0.16; 'investigate': 0.16; 'marco': 0.16; 'parameter.': 0.16; 'skip:[ 30': 0.16; 'unsafe': 0.16; 'url:windows': 0.16; 'variable.': 0.16; 'all.': 0.16; 'wrote:': 0.18; '(not': 0.18; 'wed,': 0.18; 'command': 0.22; '>>>': 0.22; 'import': 0.22; 'previously': 0.22; 'print': 0.22; 'environment': 0.24; "i've": 0.25; 'script': 0.25; 'second': 0.26; 'least': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'installed': 0.27; 'on,': 0.29; 'skip:p 30': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'usually': 0.31; 'apparently': 0.31; 'invoke': 0.31; 'file': 0.32; 'probably': 0.32; 'quite': 0.32; 'url:python': 0.33; 'maybe': 0.34; "i'd": 0.34; 'could': 0.34; 'display': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'hi,': 0.36; 'similar': 0.36; 'url:org': 0.36; 'should': 0.36; 'two': 0.37; 'list': 0.37; 'being': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'that,': 0.38; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'called': 0.40; 'even': 0.60; 'dave': 0.60; 'tell': 0.60; 'hope': 0.61; 'new': 0.61; 'simple': 0.61; "you're": 0.61; 'first': 0.61; 'name': 0.63; 'choose': 0.64; 'different': 0.65; '26,': 0.68; 'line,': 0.68; 'default': 0.69; 'user,': 0.69; 'programs,': 0.74; 'behavior': 0.77; 'missing.': 0.84; 'otten': 0.84; 'angel': 0.91; '2013': 0.98 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 :content-type; bh=FX3ePcZARgVq57WYwu6PdDRV5VgrGQtwXvF1FhwmXtw=; b=CHXLTBBoe2SPyuCTfJtfs7poHr5Im0jmIrwjMSNTIISW60uVw4kVBlH/SaZ9yzkpjh xtcbnex/62GynJ/wxrbfGCTOg0yAzzSVZewnsRWZ7NHRa5DB6ZJhtjFhUkXbr6WbMRoD FAnCSVSN+adCzoXaDAfIxR6Aaki9f0RN0c75WbDqFyemTjALg394Z3LPK15RH9SMaUg+ i27Kd7VIrfypLO2C29WUHeVpt3g67n7XwXbY2zZHiMxs0HeexqibZj076b33Y9pfdgXA eXcT6cgZ1CLMib4HAe9GICXtKU2GtfHb+pj25wi6pUNjDWS9XREDkfLx+1OWqup+GTeG /LAA== MIME-Version: 1.0 X-Received: by 10.52.163.165 with SMTP id yj5mr12297021vdb.104.1372176232406; Tue, 25 Jun 2013 09:03:52 -0700 (PDT) In-Reply-To: <51C9A673.1050006@davea.name> References: <5EDCC30CBA986647AAD0B4DA15FAC92D36FCD5FA@NLSRVWP-EXM02.ttg.global> <51C9A673.1050006@davea.name> Date: Wed, 26 Jun 2013 02:03:52 +1000 Subject: Re: Inconsistency on getting arguments From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 65 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372176697 news.xs4all.nl 15995 [2001:888:2000:d::a6]:38536 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49170 On Wed, Jun 26, 2013 at 12:17 AM, Dave Angel wrote: > On 06/25/2013 09:55 AM, Peter Otten wrote: >> >> Marco Perniciaro wrote: >> >>> Hi, >>> I've been working with Python for a long time. >>> Yet, I came across an issue which I cannot explain. >>> >>> Recently I have a new PC (Windows 7). >>> Previously I could call a Python script with or without the "python" word >>> at the beginning. Now the behavior is different if I use or not use the >>> "python" prefix! >>> >>> I only have Python 2.7 installed and the path in in my environment >>> variable. I create a simple file called "example.py" which contains two >>> lines: >>> >>> import sys >>> print sys.argv >>> >>> This is the output result: >>> >>> C:\Users\mapr>example.py a b c >>> ['C:\\Users\\mapr\\example.py'] >>> >>> C:\Users\mapr>python example.py a b c >>> ['example.py', 'a', 'b', 'c'] >>> >>> Can someone please explain? >> >> >> I'm not a Windows user, but I'd try >> >> http://docs.python.org/2/using/windows.html#executing-scripts >> >> with python.exe instead of pythonw.exe. Maybe the %* is missing. >> > > I'm not a Windows user either (at least for quite a while). But I'd > investigate with assoc and ftype and see that the ftype includes the > trailing %* parameter. Do not mess with .pyw and pythonw, as they are both > for GUI programs, and you're doing a console program. > > I think if you type ftype it'll list them all. So if you grep that, you > should be able to find the line for Python.File And yeah, you can > probably tell ftype to just display that line, but I don't have a system to > try it on, or even to use /? on, so I'm not going to issue unsafe advice. I do have access to a system to test this on, so here's the results: C:\>assoc .py .py=Python.File C:\>ftype Python.File Python.File="C:\Python27\python.exe" "%1" %* As I understand it, the first command will tell you the name that you need for the second command, and the second one will tell you what actually gets executed. I have several Pythons installed on this particular computer, apparently with 2.7 being the default (not that I care; I usually invoke "\python33\python script.py" or similar to choose my interpreter). Hope that's of value! ChrisA