473,765 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4707
co***********@y ahoo.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...@we bsafe.comwrote:
cosmo_gene...@y ahoo.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***********@y ahoo.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1116
by: burlen | last post by:
Can anyone help me? I am installing python on my new machine, an AMD 64. running fedora core 2, i get the following message: ../configure --with-libs='/usr/lib64 /lib64' .. .. .. checking size of wchar_t... configure: error: cannot compute sizeof
0
1762
by: Christopher De Vries | last post by:
The predominant operating system in my workplace is Solaris, with a bit of Linux and MacOS X thrown in. As such people expect to install new software with the sequence: ../configure make make install I've written some python modules and scripts which I packaged as a source distribution with distutils and sent it to some of my colleagues
1
1497
by: André Amram Duque | last post by:
I have problem with re-install python 2.3.4, when I execute ./configure is appear one message in config.log, follow below : configure:1710: gcc conftest.cc >&5 gcc: installation problem, cannot exec `cc1plus': No such file or directory configure:1713: $? = 1 My gnu/linux is 2.6.8-1-386(debian/sarge) Somebody could help me?
0
1319
by: Samuel M. Smith | last post by:
I am trying to build python2.4.2 on an arm 9 running Debian 3 Sarge when I run ./configure it fails with ../configure checking MACHDEP... linux2 checking EXTRAPLATDIR... checking for --without-gcc... no checking for --with-cxx=<compiler>... no checking for c++... c++
7
2393
by: Hal Vaughan | last post by:
I have a problem with port forwarding and I have been working on it for over 2 weeks with no luck. I have found C programs that almost work and Java programs that almost work, but nothing that does what I need. I've even tried writing a port forwarder in Java and found problems that nobody seems to have the answer to in forums. I need to make it work essentially the same on both Windows and Linux. There is one program, in C, that...
2
1892
by: Chris Miles | last post by:
On a standard Solaris 10 installation with Sun-supplied open-source packages installed (like SFWrline for readline libs) I cannot seem to force Python configure/setup.py to build with readline support. SFWrline installs readline in /opt/sfw/lib & /opt/sfw/include (This is all attempted with Python-2.4.3 on Solaris 10 06/06 i386) With this configure: ../configure --prefix=/opt/python-2.4.3 --enable-shared
0
1283
by: Satish S Nandihalli | last post by:
following errors were found on executing configure file: 1) configure: WARNING: thread.h: present but cannot be compiled configure: WARNING: thread.h: check for missing prerequisite headers? configure: WARNING: thread.h: see the Autoconf documentation configure: WARNING: thread.h: section "Present But Cannot Be Compiled" configure: WARNING: thread.h: proceeding with the preprocessor's result
1
1191
by: Mathieu Prevot | last post by:
Hi, I have the following error on a OSX.5 OS with CC=icc and using the python-svn files: checking size of wchar_t... configure: error: cannot compute sizeof (wchar_t) I would like to help so we can compile python with icc/OSX. Mathieu
0
1834
by: lee.walczak | last post by:
I actually post a topic relating to my problem here: (http://groups.google.co.uk/group/comp.lang.python/browse_thread/ thread/a073d532c4481bfe?hl=en# ) But I thought it could be useful to place an example of my problem here aswell. This a small piece of testcode that creates a TableList. When the cell is selected, a ComboBox Widget is used temporarily during the editing phase. It is during this ( EditStartCmd call) that I wish to...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.