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
Closed

Beets crashes on Python 3.8 #3201

s160413 opened this issue Mar 31, 2019 · 2 comments
Assignees
Labels
bug bugs that are confirmed and actionable

Comments

@s160413
Copy link

s160413 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
Copy link
Member

jackwilsdon 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 bugs that are confirmed and actionable 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
Copy link
Member

arcresu 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.

@sampsyo sampsyo closed this as completed in 8df213e Apr 1, 2019
sampsyo added a commit that referenced this issue Apr 1, 2019
@beetbox beetbox deleted a comment Nov 8, 2020
stuaxo added a commit to stuaxo/Meta that referenced this issue Feb 7, 2021
Fix issue caused by ast.Module changing signature in 3.8 causing a TypeError.

Fix suggested from:
beetbox/beets#3201 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs that are confirmed and actionable
Projects
None yet
Development

No branches or pull requests

3 participants