473,396 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Re: Newbie Question:Please help

Karthik Krishnan wrote:
Hi,

I am a newbie to python and I hope this is not a stupid question. I am
trying to run a main method from a Python command line using the command
shell using the command.

python main_test.py

I get the following error.
File "<stdin>", line 1
python main_test.py

Syntax Error: invalid syntax

My main file main_test.py is given below.

#!/usr/bin/env python

""" Test method to run the main method.

"""

def main():
print "Main method called.";
if __name__ = "__main__":
main()
Apart from the syntax error Rob pointed out (use of "=" instead of "=="
as a comparison operator) the output you show makes it seem possible you
are entering the command "python main_test.py" at the Python interpreter
interactive prompt ">>>". That won't work, as you are supposed to enter
Python statements and expressions there.

"python" is an operating system command, so you want to enter "python
main_test.py" in a command window (terminal window, shell window, call
it what you will). I'm guessing (possibly incorrectly) that you are a
Windows user, and got your interactive Python window by choosing "Python
(command line)" from the Start | Programs menu.

See the FAQ for further information, possibly

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/

Sep 12 '08 #1
0 1084

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kathy Burke | last post by:
I'm trying to figure out how to do an xpath that simply looks for a unique attribute name. For example, select the node where the name attribute is "test1"...regardless of which element. It...
4
by: hkhellhkhell | last post by:
This is a basic overall question. Please note I am new to ASP! I am currently running IIS 5/Access 2000/Windows 2000 and have developed a web application. master/detail form, the best way...
11
by: Peter | last post by:
I'm new at this stuff -- so this is probably an incredibly dopey, newby question. Please bear with me. I don't know if it's a HTML or javascript question. (Or, if a different area altogether,...
1
by: pjawde | last post by:
i'm new to this oracle thing!!!! sorry if its a dumbass question but i simply want a menu button that will talk me to certain forms......... i have created the trigger when button pressed and just...
1
by: omid1980 | last post by:
hi I have an examination and i shuld answer this question please help me. Explain the advantages of using XML with a database for ecommerce sites?
3
by: castor. | last post by:
hi all, i have two tables BOOK ------------------------------------ CODE NOT NULL NUMBER TITLE VARCHAR2(45) YEAR NUMBER
3
jenifer
by: jenifer | last post by:
Hi. I'm trying to collapse 2 tables in 1 as follows: table 1 LOC_Os01g01020 1 -1 8174 9019 LOC_Os01g01020 CDS-ANE R02-TIGRv4S1-000003F 2 1 33031 33967 LOC_Os02g01060 33032 33966 FL-AE...
6
by: =?Utf-8?B?Q2hyaXMgRA==?= | last post by:
Hi - can someone PLEASE tell me what's wrong with the script below. In debug I verified that 'registrant' has a value. I can't figure our how to build the URL & this script generates the error...
1
by: =?Utf-8?B?QXN0cml0aA==?= | last post by:
I have bin asked to use "Templated Gridview", for a project. Can somebody give me more information on how to use a "Templated Gridview", or can anybody paste any suitable website link that will...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...

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.