If you are using Windows, you should guard all of your code with:
def main():
    # Your code

if __name__=='__main__':
    main()

Since Windows uses spawn instead of fork to create processes, your code will be executed multiple times.
Have a look at the Windows FAQ 5.