Just playing around with ChatGPT. Path.rmtree is not a valid method. The correct method to use in this case (deleting a non-empty dir) is shutil.rmtree However, it did manage to answer it correctly after I pointed out its mistake.