473,807 Members | 2,853 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1119

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

Similar topics

1
1163
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 would point to either of the following -- depending on which one had the attribute name (which will always be unique). //Base/Station/Measure //Base/Station/Measure/Data
4
1337
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 would be to use ASP.net to do so. 1. is that true?
11
1354
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, please steer me to the right group.) I can view the members of the "window" object with the following javascript. It returns all the methods, properties, events, etc. <script type="text/javascript"> for(i in window)
1
1324
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 need to work out the code to go to the form called SHIPMENT help would be appreciated, thanks in advance, phil
1
1621
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
1332
by: castor. | last post by:
hi all, i have two tables BOOK ------------------------------------ CODE NOT NULL NUMBER TITLE VARCHAR2(45) YEAR NUMBER
3
1442
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 R02-TIGRv4S1-000007F 2 1 78460 79563 LOC_Os02g01140 78174 79540 FL-AE table 2 AK062483 001-103-G07 R02-TIGRv4S1-000003F
6
2288
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 "operator + cannot be applied to operands of type string & method group". MANY THANKS <a href='https://dev.onlineforms.phsa.ca/Ccsp/CcspConfirmRegistration.htm?Registrant='" + registrant.ToString + ">Confirm Registration</a></p>"
1
915
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 help to learn more on "Templated Gridview". Also , i want to know "How to bind data to the Gridview"? Pls help ---
0
9720
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
9599
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10626
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
10372
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
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4330
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
3
3011
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.