[Tutor] last part of my programme

Christian Witts cwitts at compuscan.co.za
Thu Sep 29 11:17:58 CEST 2011


On 2011/09/29 11:05 AM, ADRIAN KELLY wrote:
> can anyone tell me why the last part of my programme wont work.  i 
> want the user to have to press enter to exit but it doesn't happen 
> through the python interface.
>
> the programme works fine otherwise but just shuts down when finished
>
> thanks all
>
> adrian
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
You should run this from the command line to see the errors and tracebacks.
You have a `firstname` and `lastname` variable, no `name` variable.

Traceback (most recent call last):
   File "py_tutor.py", line 34, in <module>
     STATS()
   File "py_tutor.py", line 26, in STATS
     details=name+"\n"+town+"\n"+county
NameError: global name 'name' is not defined

Once you fix that with something like `name = firstname + ' ' + 
lastname` you'll get a further error

Press the enter key to exit.
Traceback (most recent call last):
   File "py_tutor.py", line 39, in <module>
     _ = input("\n\nPress the enter key to exit. ")
   File "<string>", line 0

Which is because input() converts the input to an integer so you would 
need to type for eg 0 then enter for it to exit without failing. 
Changing that to raw_input() like the rest of your inputs will fix that.
-- 

Christian Witts
Python Developer

//
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110929/758219a1/attachment.html>


More information about the Tutor mailing list