473,404 Members | 2,170 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,404 software developers and data experts.

>>> python test1.py / Traceback ( File "<interactive input>", line 1

I don't understand why this does not work:

<FILE1> test1.py

#Import Packages
import string
#
data=0
data=data+1

print data

<FILE2> test2.py

#Import Packages
import string
#
if __name__ == "__main__":
data=0
data=data+1

print data

<Pythonwin>
python test1.py Traceback ( File "<interactive input>", line 1
python test.py
^
SyntaxError: invalid syntax python test2.py Traceback ( File "<interactive input>", line 1
python test.py
^
SyntaxError: invalid syntax


I just don't understand why theSE line command do not work? Im new to
Pythonwin. But not new to programming (background C,C++,java,tcl,
perl,jovial,etc...)

I decided to pick up this language because I wanted a powerful script
language at hand - tcl sucks!

Jul 18 '05 #1
2 4923
On Wed, 26 Nov 2003 00:19:39 -0000, leroybt.rm wrote:
>>> python test1.py Traceback ( File "<interactive input>", line 1
python test.py
^
SyntaxError: invalid syntax


'python' is not a python command.

When you write a file intended to run as a script, run it as a command
from your operating system's command line: 'python test1.py'. This
tells 'python' (the program, invoked as a command) to interpret the
contents of the file 'test1.py' and execute all commands within it.

The interactive prompt, provided by typing 'python' with no arguments at
your operating system command prompt or by running PythonWin or other
tools, is for interactively typing in the Python statements found
*within* Python files:
import string
foo = 'blah'
print foo blah


--
\ "Misogynist: A man who hates women as much as women hate one |
`\ another." -- Henry L. Mencken |
_o__) |
Ben Finney <http://bignose.squidly.org/>
Jul 18 '05 #2
On Wed, 26 Nov 2003 00:19:39 -0000, "leroybt.rm"
<le*****@rocketmail.com> wrote:

<Pythonwin>
python test1.pyTraceback ( File "<interactive input>", line 1
python test.py
^
SyntaxError: invalid syntax python test2.pyTraceback ( File "<interactive input>", line 1
python test.py
^
SyntaxError: invalid syntax


I just don't understand why theSE line command do not work?


The commands you use should be used from an operating systems command
line (cmd.exe on Windows), not from inside the interpreter - 'python'
is not a valid python command!
If you want to run the files from inside pythonwin (never used it
myself) I assume there's a run command inside one of the menus.
If you just want to execute the commands from inside the
interpreter... well, type them in at the >>> prompt and see what
happens!
--
Christopher
Jul 18 '05 #3

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

Similar topics

4
by: Don | last post by:
Using PHP, I'm creating an <input> tag. How do you delimit the text string for the value parm of an <input> tag, when the string contains the delimit char? Example: <input...value="This text...
3
by: aa | last post by:
I am traing to output the following HTML string from PHP: "<td><input name='".$i-2."' size='2' type='text' onBlur='myfunction(".$i-2.")'></td>" But it somehow mistreats $i-2. PHP does not throw...
2
by: Don | last post by:
Can't figure this one out. The "validate" function below checks to make sure the field "names" is not null. "validate" actually calls "isEmpty", which scans the field. Here's the situation. ...
4
by: Martin Lucas-Smith | last post by:
I am wanting to know whether are XHTML1-valid characters for use within an id attribute and/or a name attribute. ...
5
by: Jonathan Daggar | last post by:
Hello, I'm trying to put together a form with a very tight table formatting. However, every time I put an text-type input field in, the browser pads the area to the right of it with space. I've...
5
by: Bart van Deenen | last post by:
Hi all I have a form with a couple of input fields, embedded within spans. I am using script.aculo.us for dragging and dropping, and want to reorder the input fields that way. The input fields are...
17
by: Alan Silver | last post by:
Hello, I have a page which I am converting to use themes. The page has an HTML <input type="image"> element that is used to post to another page. I would like to replace this with a server...
7
by: Tim Slattery | last post by:
I'm trying to handle the onChange event in an <input type="file"> element. In IE, there's no problem: the event fires when a file in the "open" box is doubleclicked, or the "Open" button in the box...
1
by: ChollaPete | last post by:
This code: <form action="processScan.php" method="get"> <p> <?php print "Scan name: <input type=\"file\" name=\"tScanFileName\" value= \"{$scanFileName}\"><br>"; addHiddenCarryons(); ?>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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,...
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
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,...
0
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...

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.