Handle Windows python file path correctly

Details in the code comments (see diff).