472,342 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,342 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 1017

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...
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...
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...
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...
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 ...
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...
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...
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

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.