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

Beets crashes on Python 3.8 #3201

Closed
s160413 opened this issue Mar 31, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@s160413
Copy link

commented Mar 31, 2019

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.

@jackwilsdon

This comment has been minimized.

Copy link
Member

commented Mar 31, 2019

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;

mod = ast.Module([func_def])

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 👍

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

@jackwilsdon jackwilsdon added the bug label Mar 31, 2019

@jackwilsdon jackwilsdon self-assigned this Mar 31, 2019

jackwilsdon added a commit to jackwilsdon/beets that referenced this issue Mar 31, 2019

@arcresu

This comment has been minimized.

Copy link
Member

commented Mar 31, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.