[Tutor] "hello world"

Gregor Lingl glingl@aon.at
Fri, 23 Nov 2001 08:03:23 +0100


Dear John!

This odd behaviour results from a misunderstanding:

If you follow the description of your tutorial, you will have
opened two windows:

1. The one for the python-shell
2. The anotherone for hello.py (which acts merely like an editor-window).

Now you have to save the content of the editor-window und to
RUN the script from THAT WINDOW.

Only the output will appear in the interactive Python-Shell window.

You apparently tried tu Run the scriopt from the shell. This asked you
first to save its content und you saved the following (or similar) to your
file:

Python 2.2b2 (#26, Nov 16 2001, 11:44:11) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> print "Hello world!"
Hello world!
>>> 

Then you tried to execute this file, which - of course - is no valid
Python program and already at 
Python 2.  
the first Syntax-Error occurs.

So, go to the edit-window for hello.py an do there according to your 
 tutorials description:

Menu - Edit - Run Script

and look at the shell:

>>>
Hello world!


now type Enter and you will arrive at the interactive prompt again!

>>>

Hope that helps! Hope you will be familiar with Python+IDLE soon

Gregor



----- Original Message ----- 
From: "john public" <apython101@yahoo.com>
To: <tutor@python.org>
Sent: Friday, November 23, 2001 3:55 AM
Subject: [Tutor] "hello world"


> I finally found python shell but I am still cannot
> save a program.
> 
> I am using this tutorial
> 
> http://us.f211.mail.yahoo.com/ym/login?.rand=8j7cu55rufoat
> 
> Here are the directions from the tutorial.
> 
> Creating and Running Programs 
> Go into IDLE if you are not already. Go to File then
> New Window. In this window type the following: 
> print "Hello, World!"
> 
> First save the program. Go to File then Save. Save it
> as 'hello.py'. (If you want you can save it to some
> other directory than the default.) Now that it is
> saved it can be run. 
> 
> Next run the program by going to Edit then Run script.
> This will output Hello, World! on the *Python Shell*
> window. 
> 
> 
> Here is what happened when I followed the directions
> 
> 
> Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit
> (Intel)] on win32
> Type "copyright", "credits" or "license" for more
> information.
> IDLE 0.8 -- press F1 for help
> >>>  print "hello, world!"
>   File "C:/Python21/Tools/idle/'hello.py'", line 1
>     Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32
> bit (Intel)] on win32
>              ^
> SyntaxError: invalid syntax
> 
>  Can some one tell me what I did wrong?
> 
>  thanx
> 
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
> http://geocities.yahoo.com/ps/info1
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>