How to configure Python in Windows

Discussion in 'Python' started by cosmo_general@yahoo.com, Feb 28, 2008.

  1. Guest

    Hi Folks,

    I just downloaded precompiled Python for Windows, and it runs. Now I
    have got the command line coding. However, I can't run my python
    scripts. My python script, foo.py, is located in C:\\....\pydir, and I
    have set the python interpreter on the directory. When I run
    os.listdir(), I found my script of foo.py is right in the pydir. But,
    when I tried to run command-line python foo.py, to compile it, I got
    "Syntax error: invalid syntax". I guess the interpreter did not find
    my script foo.py. In the past, I worked python on unix/linux, and I
    knew how set the path, and I ran my python scripts smoothly. I wonder
    anybody can help me to configure the python interpreter? Thanks!

    Muddy Coder
     
    , Feb 28, 2008
    #1
    1. Advertising

  2. Larry Bates Guest

    wrote:
    > Hi Folks,
    >
    > I just downloaded precompiled Python for Windows, and it runs. Now I
    > have got the command line coding. However, I can't run my python
    > scripts. My python script, foo.py, is located in C:\\....\pydir, and I
    > have set the python interpreter on the directory. When I run
    > os.listdir(), I found my script of foo.py is right in the pydir. But,
    > when I tried to run command-line python foo.py, to compile it, I got
    > "Syntax error: invalid syntax". I guess the interpreter did not find
    > my script foo.py. In the past, I worked python on unix/linux, and I
    > knew how set the path, and I ran my python scripts smoothly. I wonder
    > anybody can help me to configure the python interpreter? Thanks!
    >
    > Muddy Coder


    Syntax error is not give if interpreter can't find a script. You should post
    full tracebacks on this newsgroup so we can help. It is more likely that you
    actually have a syntax error in foo.py.

    -Larry
     
    Larry Bates, Feb 28, 2008
    #2
    1. Advertising

  3. Guest

    On 2ÔÂ28ÈÕ, ÏÂÎç6ʱ52·Ö, Larry Bates <> wrote:
    > wrote:
    > > Hi Folks,

    >
    > > I just downloaded precompiled Python for Windows, and it runs. Now I
    > > have got the command line coding. However, I can't run my python
    > > scripts. My python script, foo.py, is located in C:\\....\pydir, and I
    > > have set the python interpreter on the directory. When I run
    > > os.listdir(), I found my script of foo.py is right in the pydir. But,
    > > when I tried to run command-line python foo.py, to compile it, I got
    > > "Syntax error: invalid syntax". I guess the interpreter did not find
    > > my script foo.py. In the past, I worked python on unix/linux, and I
    > > knew how set the path, and I ran my python scripts smoothly. I wonder
    > > anybody can help me to configure the python interpreter? Thanks!

    >
    > > Muddy Coder

    >
    > Syntax error is not give if interpreter can't find a script. You should post
    > full tracebacks on this newsgroup so we can help. It is more likely that you
    > actually have a syntax error in foo.py.
    >
    > -Larry


    Hi Larry,

    Thanks for help. I retried to run the script. My script is as simple
    as:
    import os

    dir=os.getcwd()

    print "cwd is",dir

    The results are:

    1) If I edit it with a text editor, and try to compile at Python
    shell, the error message is: SyntaxError: invalid syntax
    2) If I run the module by pressing F5, it ran, and printed out the
    directory name

    Can you figure it out? Thanks!
     
    , Feb 29, 2008
    #3
  4. On Thu, 28 Feb 2008 18:04:23 -0800 (PST),
    declaimed the following in comp.lang.python:

    > The results are:
    >
    > 1) If I edit it with a text editor, and try to compile at Python
    > shell, the error message is: SyntaxError: invalid syntax
    > 2) If I run the module by pressing F5, it ran, and printed out the
    > directory name
    >
    > Can you figure it out? Thanks!
    >

    Must be a new class starting, two people in one day...

    The interactive python prompt is just that, and interactive prompt
    for python source lines.

    If you have a file containing python code, you execute it from the
    OS command prompt...

    c:\tmp> python my_file.py
    --
    Wulfraed Dennis Lee Bieber KD6MOG

    HTTP://wlfraed.home.netcom.com/
    (Bestiaria Support Staff: )
    HTTP://www.bestiaria.com/
     
    Dennis Lee Bieber, Feb 29, 2008
    #4
  5. Steve Holden Guest

    wrote:
    > Hi Folks,
    >
    > I just downloaded precompiled Python for Windows, and it runs. Now I
    > have got the command line coding. However, I can't run my python
    > scripts. My python script, foo.py, is located in C:\\....\pydir, and I
    > have set the python interpreter on the directory. When I run
    > os.listdir(), I found my script of foo.py is right in the pydir. But,
    > when I tried to run command-line python foo.py, to compile it, I got
    > "Syntax error: invalid syntax". I guess the interpreter did not find
    > my script foo.py. In the past, I worked python on unix/linux, and I
    > knew how set the path, and I ran my python scripts smoothly. I wonder
    > anybody can help me to configure the python interpreter? Thanks!
    >

    http://www.python.org/doc/faq/windows/

    regards
    Steve
    --
    Steve Holden +1 571 484 6266 +1 800 494 3119
    Holden Web LLC http://www.holdenweb.com/
     
    Steve Holden, Feb 29, 2008
    #5
    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. HS1
    Replies:
    0
    Views:
    480
  2. Venkat B

    Python 2.4.1 build (configure) ?

    Venkat B, Mar 31, 2005, in forum: Python
    Replies:
    1
    Views:
    285
    Skip Montanaro
    Mar 31, 2005
  3. SPE - Stani's Python Editor
    Replies:
    1
    Views:
    657
    Claudio Grondi
    Jan 26, 2006
  4. Replies:
    1
    Views:
    448
    Andrew Thompson
    Jul 24, 2006
  5. Andres M. Hidalgo

    how to install/configure Mysql in windows

    Andres M. Hidalgo, Oct 11, 2007, in forum: Ruby
    Replies:
    2
    Views:
    95
Loading...

Share This Page