greatscottgadgets/luna

Logging change commit broke Python 3.7 compatibility

supersat opened this issue · 1 comments

After updating my repo, I began getting several strange errors:

supersat@Karls-iMac luna $ examples/blinky/blinky.py
Traceback (most recent call last):
  File "examples/blinky/blinky.py", line 41, in <module>
    top_level_cli(Blinky)
  File "/Users/supersat/Projects/luna/luna/__init__.py", line 83, in top_level_cli
    configure_default_logging()
  File "/Users/supersat/Projects/luna/luna/__init__.py", line 30, in configure_default_logging
    logger.basicConfig(level=logging.INFO, format=log_format, force=True)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 1921, in basicConfig
    raise ValueError('Unrecognised argument(s): %s' % keys)
ValueError: Unrecognised argument(s): force

It turns out the force keyword was added recently in commit 488d995, but is only supported in Python 3.8 or above (see https://docs.python.org/3.8/library/logging.html#logging.basicConfig vs https://docs.python.org/3.7/library/logging.html#logging.basicConfig), while pyproject.toml and the documentation both say Python 3.7 is the minimum supported.

Not sure what the solution is here: bump the Python requirement to 3.8, or use force=True only if Python >= 3.8?

miek commented

doh, good catch - thanks! I've reverted that and pushed a better fix for the original problem.