Return a string result with out breaking loop

Andrew nobody at yahoo.com
Mon Aug 25 21:20:41 EDT 2008


Yes I found many examples similiar to that but Yield still produces that 
error

Sorry if I sound Novice but I have no formal education in programming so 
understanding something takes me a bit longer than most of you guys :-D

Ive included a bit more of the function

How ever unimportant it may be


def watchos(self, path_to_watch="C:\\"):
    FILE_LIST_DIRECTORY = 0x0001
    try: path_to_watch or "."
    except: path_to_watch = "."
    path_to_watch = os.path.abspath(path_to_watch)

    out1 = "Watching %s at %s" % (path_to_watch, time.asctime()) + "\n\n"
    while 1:

        #INSERT MORE CODE HERE

        results = change_handle
        for action, files in results:
        	    full_filename = os.path.join(path_to_watch, files)
             theact = ACTIONS.get(action, "Unknown")
             yield str(full_filename) +  " " + str(theact)

But I am having a hard time wrapping my head around yield... perhaps if 
it produced more than the same error no matter what I did. I could try 
and get a bit further

Anyway once again I appreciate the help cheers

:-)



More information about the Python-list mailing list