Yes, I read it and tried the global statement with the same results, and tried it without the keyop set. It gave a prompt, and died as before.   Now I've inserted the global statement in the function and it  works by print out the value of updown inside the function.  Beats me. (read below)

I do not think I've made an inaccurate observation. Is it possible the IDLE shell is leaving something behind that I can't see? Maybe I had two shell window up at the same time between the real and debug program.

I just started from scratch with the debug program minus the keyop set, and Python discovered it wasn't set. Oh, well. Gads. I just changed the def function name, and it ran! I now changed the def function name again, and it ran. Oh, boy. I now have closed all IDLE windows, and tried the debug again. It catches the misnamed function. Yikes!

I just inserted the global statement in the full program, and it's working. This was not the case yesterday. I give up trying to explain this. It works as it should, so I'm going to continue making the mods before all this happened.

Sander Sweers wrote:
On Sat, Sep 20, 2008 at 00:23, Wayne Watson
<[EMAIL PROTECTED]> wrote:
  
Well, it made a difference, and now program and output are in agreement.
    

Not really the code has an error so it could not have worked.

  
updown = +1
while keyop <> 0:
    

You forgot to create keyop in this example.

  
UnboundLocalError: local variable 'updown' referenced before assignment
...
http://effbot.org/pyfaq/how-do-you-set-a-global-variable-in-a-function.htm
    

Did you actually read the link Kent provided? It does not look like you did.

Greets
Sander

  

--
Signature.html
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
              Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet
            
            "Though no one can go back and make a brand new start, 
	     ANYONE can start from now and make a brand new end." 
		                    -- Anonymous
            
                    Web Page: <www.speckledwithstars.net/>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to