Example #1
0
def ReadFile(thefile,queue):
    try:
        with open(thefile,'r') as f:
            for eachline in f:
                emails = catchemail(eachline.strip())
                for eachmail in emails:
                    try:
                        queue.put(eachmail,1)
                    except Queue.Full:
                        Queue.sleep(1)
            queue.put('quit',1)
    except IOError,e:
        print e
Example #2
0
def WriteFile(thefile,queue):
    try:
        with open(thefile,'w') as f:
            while True:
                try:
                    theline = queue.get(1)
                    if theline == 'quit':
                        break
                    else:
                        f.write(theline+'\n')
                except Queue.Empty,e:
                    Queue.sleep(1)
    except IOError,e:
        print e