Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Unrecognised argument(s): encoding #47

Closed
edoardottt opened this issue Dec 27, 2021 · 0 comments
Closed

ValueError: Unrecognised argument(s): encoding #47

edoardottt opened this issue Dec 27, 2021 · 0 comments

Comments

@edoardottt
Copy link
Owner

If twitterbot2 gives you this error:

$> python3 twitterbot2.py -h
Traceback (most recent call last):
  File "http://twitterbot2.py", line 668, in <module>
    main()
  File "http://twitterbot2.py", line 581, in main
    format=http://globals.bot_user + ": %(levelname)s:%(asctime)s | %(message)s",
  File "/Library/Frameworks/Python.framework/Versions/3.x/lib/python3.x/logging/__init__.py", line 1919, in basicConfig
    raise ValueError('Unrecognised argument(s): %s' % keys)
ValueError: Unrecognised argument(s): encoding

The problem is at this line and you have two solutions:

  • Upgrade python to version 3.9
  • OR
  • Edit your twitterbot2.py file deleting the basicConfig method and use instead:
root_logger= logging.getLogger(__name__)
root_logger.setLevel(logging.INFO)
handler = logging.FileHandler('twitterbot2.log', 'a', 'utf-8')
handler.setFormatter(logging.Formatter(globals.bot_user + ": %(levelname)s:%(asctime)s | %(message)s"))
root_logger.addHandler(handler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant