Hello, I tried the script on my account (that has two-factor authentication enabled), and it returned the following error:
prawcore.exceptions.OAuthException: invalid_grant error processing request
I tried temporarily disabling 2FA and that did the trick, so it seems that the script doesn't work correctly with 2FA.