Beets: Beets crashes on Python 3.8

Created on 31 Mar 2019  路  2Comments  路  Source: beetbox/beets

Problem

Beets crashes when running any command.

$ beet
Traceback (most recent call last):
  File "C:\Python38\Scripts\beet-script.py", line 11, in <module>
    load_entry_point('beets==1.4.8', 'console_scripts', 'beet')()
  File "C:\Python38\lib\site-packages\beets-1.4.8-py3.8.egg\beets\ui\__init__.py
", line 1266, in main
    _raw_main(args)
  File "C:\Python38\lib\site-packages\beets-1.4.8-py3.8.egg\beets\ui\__init__.py
", line 1249, in _raw_main
    subcommands, plugins, lib = _setup(options, lib)
  File "C:\Python38\lib\site-packages\beets-1.4.8-py3.8.egg\beets\ui\__init__.py
", line 1144, in _setup
    lib = _open_library(config)
  File "C:\Python38\lib\site-packages\beets-1.4.8-py3.8.egg\beets\ui\__init__.py
", line 1201, in _open_library
    get_path_formats(),
  File "C:\Python38\lib\site-packages\beets-1.4.8-py3.8.egg\beets\ui\__init__.py
", line 619, in get_path_formats
    path_formats.append((query, Template(view.as_str())))
  File "C:\Python38\lib\site-packages\beets-1.4.8-py3.8.egg\beets\util\functempl
ate.py", line 558, in __init__
    self.compiled = self.translate()
  File "C:\Python38\lib\site-packages\beets-1.4.8-py3.8.egg\beets\util\functempl
ate.py", line 591, in translate
    func = compile_func(
  File "C:\Python38\lib\site-packages\beets-1.4.8-py3.8.egg\beets\util\functempl
ate.py", line 147, in compile_func
    prog = compile(mod, '<generated>', 'exec')
TypeError: required field "type_ignores" missing from Module

Setup

  • OS: Windows 10 64-bit
  • Python version: Python 3.8a3
  • beets version: 1.4.8 (git-master)
  • Turning off plugins made problem go away (yes/no): no

My configuration (output of beet config) is:

empty

I've also compiled the wheel from git master obviously, I was having this issue from just installing it from pip normally, so I thought doing this manually would solve my issues, but it didn't. I don't really understand why this error occurs, but I imagine it has something to do with the dependencies of this project.

bug

Most helpful comment

Related to Python 3.8 support: on Python 3.7 I was seeing a deprecation warning about collections.abc and the docs indicate that this is expected to become an error in versions after Python 3.7 (although the current 3.8 seems not to have this change yet). #3197 fixes that.

All 2 comments

So it looks like the call signature of ast.Module changed in 3.8 from Module(stmt* body) to Module(stmt* body, type_ignore *type_ignores) which is annoying, although it looks like we should be able to change this line;

https://github.com/beetbox/beets/blob/728267d06c98b3696c1ba05b16b3f9b646f713e8/beets/util/functemplate.py#L144

To something like this;

if sys.version_info >= (3, 8):
    mod = ast.Module([func_def], [])
else:
    mod = ast.Module([func_def])

~I'm not really available to work on this right now, so hopefully this gives someone else a head-start.~ I'm going to go ahead and pick this up anyway :+1:

It might be worth enabling 3.8 on Travis too, although it is only officially being released in October this year.

Related to Python 3.8 support: on Python 3.7 I was seeing a deprecation warning about collections.abc and the docs indicate that this is expected to become an error in versions after Python 3.7 (although the current 3.8 seems not to have this change yet). #3197 fixes that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

foways picture foways  路  5Comments

bartkl picture bartkl  路  3Comments

ItsKonix picture ItsKonix  路  4Comments

vredesbyyrd picture vredesbyyrd  路  4Comments

hashhar picture hashhar  路  3Comments