Title: Signature.html
Yes, I noticed that it does not seem to correspond to the actual code. The "print updown" line is not to be seen and the line # it points to seems erroneous. Line 35 is the "Date OK" remark. I'm going to bring down IDLE. To see if that helps.

Well, it made a difference, and now program and output are in agreement. It seems like some of the code I chopped out of the original program was still active. I reworked the original to get this.

Here's what I get now.
import os, os.path, sys
# The following import is necessary for Python to use the datetime
# strftime method. See comments with use of that method below.
from datetime import datetime, timedelta
import re
import time

def morris():
    print abc

def sync_low2high_files():
    # restore order to natural low to high state
    print updown
    if updown == -1:
        # Sort low to high
        dat_files.sort(reverse = False)
        txt_files.sort(reverse = False)
        rename_files.sort(reverse = False)
        updown = +1
    return

updown = +1
while keyop <> 0:
    print
    keyin = raw_input("Enter operation number (h for help): ")

    keyop = int(keyin)

    # Perform commands
    if (keyop == 1): # shift starting dates of files to new date
        print
        start_date = raw_input( "Enter new start date (yyyy/mm/dd): ")
        # Date OK. Assemble date for file name
        print "updown in loop",updown
        sync_low2high_files()
   
print "bottomed out"
Results:
Enter operation number (h for help): 1

Enter new start date (yyyy/mm/dd): 111
updown in loop 1
Traceback (most recent call last):
  File "C:/Sandia_Meteors/Improved_Sentinel/Sentinel_Playground/Utility_Dev/debug.py", line 35, in ?
    sync_low2high_files()
  File "C:/Sandia_Meteors/Improved_Sentinel/Sentinel_Playground/Utility_Dev/debug.py", line 13, in sync_low2high_files
    print updown
UnboundLocalError: local variable 'updown' referenced before assignment
...

http://effbot.org/pyfaq/how-do-you-set-a-global-variable-in-a-function.htm

Kent

  

--
           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