Executing python script in non-interactive mode on cygwin (windows)

Discussion in 'Python' started by Pankaj, Jan 23, 2006.

  1. Pankaj

    Pankaj Guest

    I am facing a very basic problem as any new bie would face.

    I know perl and now i want to use python

    In perl, it is very simple , just
    "perl scriptname.pl"
    will execute the script.

    But i think python is worse than perl

    It takes to interactive mode , which i don;t want to use.

    "python scriptname.py"
    does not execute python script

    It was, i don't know executing it or not.

    1. I placed these contents in a file named "1.py"
    a,b=0,1
    n=5
    while n<=0:
    print b
    a=b
    b=a+b
    n=n-1
    print n

    Then

    2.
    on "cygwin shell in windows"
    i gave "python 1.py"

    hoping that it will exeucte and give me output, but nothing was
    printed

    Does python not support teh non-interactive mode of execution

    I have the manuals and they dont' specify this thing anywhere. they
    tell use "python -c filename"


    Please help.
    A newbie's request.

    Pankaj
    i gav
     
    Pankaj, Jan 23, 2006
    #1
    1. Advertising

  2. Re: Executing python script in non-interactive mode on cygwin(windows)

    "Pankaj" wrote:

    > I know perl and now i want to use python
    >
    > In perl, it is very simple , just
    > "perl scriptname.pl"
    > will execute the script.
    >
    > But i think python is worse than perl
    >
    > It takes to interactive mode , which i don;t want to use.
    >
    > "python scriptname.py"
    > does not execute python script
    >
    > It was, i don't know executing it or not.
    >
    > 1. I placed these contents in a file named "1.py"
    > a,b=0,1
    > n=5
    > while n<=0:
    > print b
    > a=b
    > b=a+b
    > n=n-1
    > print n
    >
    > Then
    >
    > 2.
    > on "cygwin shell in windows"
    > i gave "python 1.py"
    >
    > hoping that it will exeucte and give me output, but nothing was
    > printed
    >
    > Does python not support teh non-interactive mode of execution


    > n=5
    > while n<=0:


    not sure about Perl, but in Python, five is not less than or equal
    to zero.

    maybe you meant to write:

    n=5
    while n >= 0:

    ?

    </F>
     
    Fredrik Lundh, Jan 23, 2006
    #2
    1. Advertising

  3. Pankaj

    Pankaj Guest

    Thanks

    it was my mistake
     
    Pankaj, Jan 23, 2006
    #3
  4. Pankaj enlightened us with:
    > But i think python is worse than perl


    No it isn't.

    > It takes to interactive mode , which i don;t want to use.


    Then don't use it.

    > "python scriptname.py"
    > does not execute python script


    Yes it does.

    > 1. I placed these contents in a file named "1.py"
    > a,b=0,1
    > n=5
    > while n<=0:


    Which is immediately false.

    > on "cygwin shell in windows"
    > i gave "python 1.py"
    >
    > hoping that it will exeucte and give me output, but nothing was
    > printed


    Which is correct for your program.

    Sybren
    --
    The problem with the world is stupidity. Not saying there should be a
    capital punishment for stupidity, but why don't we just take the
    safety labels off of everything and let the problem solve itself?
    Frank Zappa
     
    Sybren Stuvel, Jan 23, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. WJ
    Replies:
    2
    Views:
    493
  2. Alex
    Replies:
    1
    Views:
    320
    Peter Hansen
    Sep 9, 2005
  3. John J Lee
    Replies:
    3
    Views:
    489
    bruno at modulix
    Dec 1, 2005
  4. Edward Loper
    Replies:
    0
    Views:
    473
    Edward Loper
    Aug 7, 2007
  5. Himanshu
    Replies:
    0
    Views:
    930
    Himanshu
    Nov 18, 2009
Loading...

Share This Page