You cannot open a file twice on windows, so the call to urllib.request.urlretrieve was invalid, since we already opened the temporary file. urlretrieve without a filename will automatically create and return a temp-file, so we're fine.