bmoe 0 Newbie Poster

What is the best way to terminate ReadFile once the data is done being read? I just sits there an hangs! I'm kinda new to Python so be easy on me! :) The other way i was able to read info from my pipe was blah = open(pipe) then blah.read() but i end up in the same situation.

pipeName = "\\\\.\\PIPE\\MYPIPE"
try:
    pipeHandle = win32file.CreateFile(pipeName,win32file.GENERIC_READ,0,None,win32file.CREATE_NEW|win32file.OPEN_EXISTING,0,None)  
except:
    print "App Not running..."
debugLog = ''

while (1):
    try:
        hr, data = win32file.ReadFile(pipeHandle, 8192, None)
        if len(data) > 1:
            debugLog = debugLog + data
            if "Boot" in debugLog:
                print "Booted to DOS..."
                break
            else:
                print "Not booted 1"
                break
        else:
            print "Not booted 2"
            break
    except:
        print "Not booted 3"
        break
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.