Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33216

Re: Simple Question regarding running .py program

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <joyhou2010@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'interpreter': 0.04; 'happen,': 0.07; 'key.': 0.07; 'subject:Question': 0.07; 'python': 0.09; 'cmd': 0.09; 'interpreter,': 0.09; 'script,': 0.09; 'to:addr:comp.lang.python': 0.09; 'typed': 0.09; 'useless': 0.09; 'windows,': 0.09; 'cc:addr :python-list': 0.10; 'yet.': 0.13; 'folks': 0.15; '"idle"': 0.16; 'bugs.': 0.16; 'closes': 0.16; 'cmd,': 0.16; 'did.': 0.16; 'invisible': 0.16; 'newsgroup.': 0.16; 'script?': 0.16; 'sth': 0.16; 'subject:program': 0.16; 'windows:': 0.16; 'wrote:': 0.17; 'specify': 0.17; 'shell': 0.18; '>>>': 0.18; 'windows': 0.19; 'meant': 0.21; 'latter': 0.22; 'please?': 0.22; 'stick': 0.22; 'runs': 0.22; 'work.': 0.23; 'monday,': 0.23; "haven't": 0.23; 'installed': 0.23; "i've": 0.23; 'command': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'skip:" 20': 0.26; 'cc:addr:gmail.com': 0.27; 'first,': 0.27; 'guess': 0.27; 'question': 0.27; 'cc:2**2': 0.27; 'dos': 0.27; 'mind.': 0.27; "doesn't": 0.28; 'correct': 0.28; 'run': 0.28; 'post': 0.28; '(perhaps': 0.29; 'clicked': 0.29; 'running.': 0.29; 'case,': 0.29; 'window': 0.30; 'basic': 0.30; 'function': 0.30; 'system,': 0.32; 'running': 0.32; 'could': 0.32; 'subject: .': 0.33; 'subject:Simple': 0.33; 'subject:regarding': 0.33; 'anyone': 0.33; 'that,': 0.34; 'version': 0.34; 'changed': 0.34; 'program,': 0.34; 'received:google.com': 0.34; 'along': 0.35; 'filter': 0.35; 'open': 0.35; 'pm,': 0.35; 'posting': 0.35; 'received:209.85.220': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'list.': 0.35; 'really': 0.36; 'but': 0.36; 'cc:no real name:2**1': 0.36; "didn't": 0.36; 'should': 0.36; 'thank': 0.36; 'problems': 0.36; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'some': 0.38; 'called': 0.39; 'google': 0.39; 'help': 0.40; 'end': 0.40; 'your': 0.60; 'containing': 0.61; 'first': 0.61; 'here': 0.65; 'charset:windows-1252': 0.65; 'gave': 0.65; 'covers': 0.65; 'frequently': 0.65; 'matter.': 0.65; 'article': 0.78; 'all!': 0.84; 'around,': 0.84; "it'd": 0.84; 'launches': 0.84; 'reply!': 0.84; 'run?': 0.84; 'subject:running': 0.84; 'angel': 0.93
Newsgroups comp.lang.python
Date Mon, 12 Nov 2012 18:45:45 -0800 (PST)
In-Reply-To <mailman.3605.1352773507.27098.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=155.41.6.66; posting-account=wDXvlQoAAACRpk956PaJoLasJERVwogk
References <fbc6ecf4-9aa9-4b29-9308-0ed81a3b5bf9@googlegroups.com> <mailman.3605.1352773507.27098.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 155.41.6.66
MIME-Version 1.0
Subject Re: Simple Question regarding running .py program
From Caroline Hou <joyhou2010@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org, d@davea.name, Caroline Hou <joyhou2010@gmail.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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.3606.1352774755.27098.python-list@python.org> (permalink)
Lines 110
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352774755 news.xs4all.nl 6894 [2001:888:2000:d::a6]:47658
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33216

Show key headers only | View raw


On Monday, 12 November 2012 21:25:08 UTC-5, Dave Angel  wrote:
> On 11/12/2012 09:02 PM, Caroline Hou wrote:
> 
> > Hi all!
> 
> >
> 
> > I just started learning Python by myself and I have an extremely simple question now!
> 
> > I am in my Python interpreter now and I want to open/edit a program called nobel.py. But when I typed >>> python nobel.py, it gave me a "SyntaxError:invalid syntax”( I've changed to the correct directory)what should I do?
> 
> > I also want to run the program, but as I double-clicked the program, a command window pops up and closes immediately. How can I see the result of the program run?
> 
> > Could anyone help me please? I am pretty confused here...Thank you!
> 
> 
> 
> It'd be nice to specify that you're running Windows, and also what
> 
> version of the interpreter, although in this case the latter doesn't matter.
> 
> 
> 
> 
> 
> Go to a shell (cmd.exe), change to the directory containing that script,
> 
> and type the command as you did.
> 
> 
> 
> On linux:  davea@think:~$ python nobel.py
> 
> On Windows:   c:\mydir\myscript > python nobel.py
> 
> 
> 
> If you're already in the python interpreter, then running python is
> 
> useless -- it's already running.  In that case, you might want to use
> 
> import.  However, I recommend against it at first, as it opens up some
> 
> other problems you haven't experience with yet.
> 
> 
> 
> When you say you "double clicked the program', we have to guess you
> 
> might have meant in MS Explorer.  If you do that, it launches a cmd, it
> 
> runs the python system, and it closes the cmd.  Blame Windows for not
> 
> reading your mind.  If you want the cmd window to stick around, you
> 
> COULD end your program with an raw_input function call, but frequently
> 
> that won't work.  The right answer is the first one above...   Open a
> 
> shell (perhaps with a menu like  DOS BOX), change...
> 
> 
> 
> That way, when the program finishes, you can see what happened, or
> 
> didn't happen, and you can run it again using the uparrow key.
> 
> 
> 
> BTW, you don't need to send email to both the python-list and to the
> 
> newsgroup.  The newsgroup is automatically fed from the list.  But since
> 
> you're posting from google groups, that's just one of the bugs.  Many
> 
> folks here simply filter out everything from google groups, so your post
> 
> is invisible to them.
> 
>    
> 
> 
> 
> -- 
> 
> 
> 
> DaveA

Hi Dave!

thank you very much for your quick reply! I did manage to get the program run from cmd.exe. 
So does it mean that if I want to use python interactively,I should use the interpreter,while if I just want to run a python program, I should use DOS shell instead?
Also, how could I edit my script? I have sth called "IDLE" installed along with python. Is it the right place to write/edit my script?
Sorry about these semi-idiot questions but it is really hard to find an article or book that covers such basic stuffs! 
Thank you!

Caroline Hou

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Simple Question regarding running .py program Caroline Hou <joyhou2010@gmail.com> - 2012-11-12 18:02 -0800
  Re: Simple Question regarding running .py program Dave Angel <d@davea.name> - 2012-11-12 21:24 -0500
    Re: Simple Question regarding running .py program Caroline Hou <joyhou2010@gmail.com> - 2012-11-12 18:45 -0800
      Re: Simple Question regarding running .py program Terry Reedy <tjreedy@udel.edu> - 2012-11-13 01:21 -0500
      Re: Simple Question regarding running .py program Dave Angel <d@davea.name> - 2012-11-13 04:25 -0500
      Re: Simple Question regarding running .py program Ramchandra Apte <maniandram01@gmail.com> - 2012-11-13 04:35 -0800
        Re: Simple Question regarding running .py program Caroline Hou <joyhou2010@gmail.com> - 2012-11-13 19:31 -0800
          Re: Simple Question regarding running .py program Chris Angelico <rosuav@gmail.com> - 2012-11-14 15:10 +1100
            Re: Simple Question regarding running .py program rurpy@yahoo.com - 2012-11-13 21:08 -0800
              Re: Simple Question regarding running .py program Chris Angelico <rosuav@gmail.com> - 2012-11-14 17:02 +1100
                Re: Simple Question regarding running .py program rurpy@yahoo.com - 2012-11-13 23:02 -0800
                Re: Simple Question regarding running .py program rusi <rustompmody@gmail.com> - 2012-11-13 23:52 -0800
                Re: Simple Question regarding running .py program Chris Angelico <rosuav@gmail.com> - 2012-11-15 00:35 +1100
                Re: Simple Question regarding running .py program rurpy@yahoo.com - 2012-11-14 10:20 -0800
                Re: Simple Question regarding running .py program Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-14 23:07 +0000
                Re: Simple Question regarding running .py program rurpy@yahoo.com - 2012-11-14 15:57 -0800
                Re: Simple Question regarding running .py program Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-15 00:30 +0000
                Re: Simple Question regarding running .py program rurpy@yahoo.com - 2012-11-15 13:29 -0800
                Re: Simple Question regarding running .py program Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-11-15 22:15 +0000
                Re: Simple Question regarding running .py program Grant Edwards <invalid@invalid.invalid> - 2012-11-16 02:55 +0000
                Re: Simple Question regarding running .py program Duncan Booth <duncan.booth@invalid.invalid> - 2012-11-22 11:35 +0000
                Re: Simple Question regarding running .py program rusi <rustompmody@gmail.com> - 2012-11-15 20:10 -0800
                Re: Simple Question regarding running .py program Chris Angelico <rosuav@gmail.com> - 2012-11-16 17:37 +1100
                Re: Simple Question regarding running .py program Chris Angelico <rosuav@gmail.com> - 2012-11-16 17:38 +1100
                Re: Simple Question regarding running .py program Terry Reedy <tjreedy@udel.edu> - 2012-11-14 20:18 -0500
          Re: Simple Question regarding running .py program Terry Reedy <tjreedy@udel.edu> - 2012-11-14 20:08 -0500
    Re: Simple Question regarding running .py program Caroline Hou <joyhou2010@gmail.com> - 2012-11-12 18:45 -0800

csiph-web