Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Figured bass realization breaks using Python 3.11

Đang mở Phù hợp với người mới
#1,646 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
75/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Lỗi crash nằm trong getRandomPossibilityProgression ở music21/figuredBass/realizer.py (khoảng dòng 679), nơi random.sample được gọi trên currMovements.keys(). Python 3.11 từ chối dict views làm tập hợp mẫu, vì vậy hãy xem lệnh gọi đó cần gì và kết quả được dùng như thế nào. Chạy đoạn mã tái hiện trong issue (examples.exampleA().realize().generateRandomRealization()) để xác nhận TypeError. Hoàn thành khi lệnh gọi chạy được trên Python 3.11 và generateRandomRealization chạy không lỗi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

music21 version
9.1.0

Problem summary
Figured bass realization breaks using Python 3.11

Steps to reproduce

from music21.figuredBass import examples
fbLine = examples.exampleA()
fbRealization1 = fbLine.realize()
fbRealization1.generateRandomRealization().show()

Expected vs. actual behavior
Output should open Musescore or something similar to show the figured bass realization. Instead the following error is given:

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2022.3.2\plugins\python\helpers\pydev\pydevconsole.py", line 364, in runcode
    coro = func()
           ^^^^^^
  File "<input>", line 4, in <module>
  File "C:\Users\user\...\Lib\site-packages\music21\figuredBass\realizer.py", line 790, in generateRandomRealization
    possibilityProgression = self.getRandomPossibilityProgression()
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\...\Lib\site-packages\music21\figuredBass\realizer.py", line 679, in getRandomPossibilityProgression
    prevPossib = random.sample(currMovements.keys(), 1)[0]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\random.py", line 439, in sample
    raise TypeError("Population must be a sequence.  "
TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).

More information
This is on Windows with musescore.

Ngôn ngữ chính
Python
Star
2.6k
Fork
459
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
40

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cuthbertLab/music21

Tất cả issue của cuthbertLab/music21

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.