Solved by ptrblck in post #2 
              
              
                Is your code running fine using num_workers=0? 
If you are using multiple workers on Windows, you should add the if-clause protection as described in the Windows FAQ.