473,583 Members | 4,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

>>> python test1.py / Traceback ( File "<interacti ve 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 "<interacti ve input>", line 1
python test.py
^
SyntaxError: invalid syntax python test2.py Traceback ( File "<interacti ve 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 4941
On Wed, 26 Nov 2003 00:19:39 -0000, leroybt.rm wrote:
>>> python test1.py Traceback ( File "<interacti ve 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*****@rocket mail.com> wrote:

<Pythonwin>
python test1.pyTraceback ( File "<interacti ve input>", line 1
python test.py
^
SyntaxError: invalid syntax python test2.pyTraceback ( File "<interacti ve 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
2460
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 has a " in it"...> I tried preceeding the " with a the escape char \, but the browser apparently still used the embedded " as termination of the...
3
2426
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 any errors but the browser renders the table incorrectly. I got round this by introducing another variable j=i-2 and using it in place of i-2 It...
2
1713
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. <input> for "names" first existed in an html file. The test worked just fine there. If the field was filled, the test would pass. If the field was...
4
21282
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. http://validator.w3.org/check?uri=http://www-thaihydro.geog.cam.ac.uk/riverslice/&ss=1&verbose=1 (e.g. see line 77) suggests that it is valid, but the spec suggests that it is not. More detail:
5
13102
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 tried to eliminate it several ways, but it won't go away. It looks like it's forcing at least one space (line break?) in after each field, and...
5
2238
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 display:inline because I want them all on the same line. Does anyone know of a smart trick to be able to drag these input fields? Just setting...
17
3185
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 control so I can add a skinid. I tried adding runat="server" and the skinid to the existing control, but that didn't work. Any other ideas? TIA --
7
20858
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 is clicked, or "Enter" is hit in the attached text box. I can get the value of the element. But in Netscape 7, onChange doesn't fire until focus...
1
14025
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(); ?> <input type="submit">
0
7894
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...
0
7825
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...
1
7933
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...
0
8191
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...
0
6578
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...
1
5700
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...
0
3816
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...
1
1431
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1155
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...

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.