ValueError: Name node can't be used with 'None' constant

I’m running beets on my iMac since some times now and now I’m getting the following error when running beets (even beet version):

ValueError: Name node can't be used with 'None' constant

This is using Homebrew, python@3.8 and the latest beets installed via pip3. Other python packages are all up to date. The list of installed packages:

autopep8       1.5.3
beets          1.4.9
certifi        2020.6.20
chardet        3.0.4
discogs-client 2.3.0
entrypoints    0.3
flake8         3.8.3
idna           2.10
jellyfish      0.8.2
lxml           4.5.2
mccabe         0.6.1
munkres        1.1.2
musicbrainzngs 0.7.1
mutagen        1.45.0
oauthlib       3.1.0
peewee         3.13.3
pip            20.1.1
pony           0.7.13
pycairo        1.19.1
pycodestyle    2.6.0
pyflakes       2.2.0
PyGObject      3.36.1
pymediainfo    4.2.1
python-slugify 4.0.1
PyYAML         5.3.1
requests       2.24.0
rope           0.17.0
setuptools     49.2.0
six            1.15.0
text-unidecode 1.3
toml           0.10.1
Unidecode      1.1.1
urllib3        1.25.9
wheel          0.34.2

Any ideas what can cause the issue. The complete trace is

Traceback (most recent call last):
  File "/usr/local/bin/beet", line 8, in <module>
  File "/usr/local/lib/python3.8/site-packages/beets/ui/", line 1266, in main
  File "/usr/local/lib/python3.8/site-packages/beets/ui/", line 1249, in _raw_main
    subcommands, plugins, lib = _setup(options, lib)
  File "/usr/local/lib/python3.8/site-packages/beets/ui/", line 1144, in _setup
    lib = _open_library(config)
  File "/usr/local/lib/python3.8/site-packages/beets/ui/", line 1201, in _open_library
  File "/usr/local/lib/python3.8/site-packages/beets/ui/", line 619, in get_path_formats
    path_formats.append((query, template(view.as_str())))
  File "/usr/local/lib/python3.8/site-packages/beets/util/", line 571, in template
    return Template(fmt)
  File "/usr/local/lib/python3.8/site-packages/beets/util/", line 581, in __init__
    self.compiled = self.translate()
  File "/usr/local/lib/python3.8/site-packages/beets/util/", line 614, in translate
    func = compile_func(
  File "/usr/local/lib/python3.8/site-packages/beets/util/", line 155, in compile_func
    prog = compile(mod, '<generated>', 'exec')
ValueError: Name node can't be used with 'None' constant

Hello! The issue template on GitHub has instructions for what we need to help with crashes:

Namely, we can’t really say much without seeing your config.

One guess, however, is that you’re running into this issue:

Looking at this I think you’re right. I will revert some things back to previous versions and watch for ast related changes before I upgrade things again.