[Tutor] Problem with "Hello, World"

Alexander Dering alex.dering at gmail.com
Sat Apr 28 12:49:27 CEST 2007


So I've written my first python program (the ubiquitous 'Hello, World').

Already, I'm having problems. First, the question I can't find the answer
to.

Where (exactly) am I supposed to save my files? When I wrote "hello.py"
there was no clearly stated "Make sure you save it HERE or else Python won't
know where to look for it."

In case that won't solve the problem, here are the gory details.

I wrote "hello.py" with TextWrangler. I can get it to run from TextWrangler
by clicking on the "run in terminal" command. And it runs beautifully. A
masterful demonstration of my ability to follow directions.

But I can't get it to run directly from Python. If I go to the terminal and
type "python hello.py" (which is what the instructions say I should be
doing!) I get the following:

>>> hello.py
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'hello' is not defined
>>>

When I run debugger (in TextWrangler) I get the following:

Traceback (most recent call last):
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/pdb.py",
line 9, in ?
    import cmd
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/cmd.py",
line 48, in ?
    import string
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/string.py",
line 83, in ?
    import re as _re
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/re.py",
line 5, in ?
    from sre import *
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/sre.py",
line 97, in ?
    import sre_compile
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/sre_compile.py",
line 17, in ?
    assert _sre.MAGIC == MAGIC, "SRE module mismatch"
AssertionError: SRE module mismatch
logout
[Process completed]


All help gratefully taken with both hands!

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070428/3eca5f25/attachment.htm 


More information about the Tutor mailing list