469,603 Members | 2,329 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,603 developers. It's quick & easy.

How to configure Python in Windows

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 '08 #1
3 4522
co***********@yahoo.com 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
Feb 28 '08 #2
On 2月28日, 下午6时52分, Larry Bates <larry.ba...@websafe.comwrote:
cosmo_gene...@yahoo.com 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 '08 #3
co***********@yahoo.com 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/

Feb 29 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by burlen | last post: by
reply views Thread by Christopher De Vries | last post: by
1 post views Thread by Andr Amram Duque | last post: by
reply views Thread by Samuel M. Smith | last post: by
reply views Thread by Satish S Nandihalli | last post: by
1 post views Thread by Mathieu Prevot | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.