[EMAIL PROTECTED] wrote: >I am using winGuiAuto to test a program. I want to check that a > varible is set. > > In the following code I am doing if(len(str(hwnd)) < 0) What is the > python way?
you're expecting a string with negative length? that's pretty weird. what language uses that mechanism to report errors? > def clickNdSyncStopButton(hwnd=None): > ....if(hwnd == None): > ........hwnd = winGuiAuto.findTopWindow("NDSync") that's usually written: if hwnd is None: ... > ....if(len(str(hwnd)) < 0): > ........raise "Failed to find the NDSync Dialog" according to the winGuiAuto documentation, the findTopWindow function raises an exception if it cannot find a window; maybe you should just ignore that, and let the user code deal with that exception instead of your uncatchable string literals... (rereading the chapter on exceptions in your favourite Python tutorial cannot hurt) </F> -- http://mail.python.org/mailman/listinfo/python-list