You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
replaygain: threads: 0 in config crashes beet replaygain with ValueError (only --threads 0 works) #7113
threads: 0 in the replaygain config crashes beet replaygain instead of disabling the pool. Only --threads 0 on the command line works. This came up in passing in #7112 ("that is a separate issue"), so filing it so it doesn't get lost.
$ beet replaygain
...
File "/usr/lib/python3.13/multiprocessing/pool.py", line 205, in __init__
raise ValueError("Number of processes must be at least 1")
ValueError: Number of processes must be at least 1
beet replaygain --threads 0 with the same config runs fine ("Analyzing 0 tracks ~ ffmpeg backend...").
If I'm reading command_func right (master, b8711d8), the reason is that opts.threads is None when the flag isn't passed, so opts.threads != 0 is true and None or self.config["threads"].get(int) gives 0 → ThreadPool(0). The import path already guards this (and threads before open_pool), only the CLI command doesn't.
Something like this fixes it for me:
- # Bypass self.open_pool() if called with `--threads 0`- if opts.threads != 0:- threads: int = opts.threads or self.config["threads"].get(int)+ # Bypass self.open_pool() if called with `--threads 0` or if+ # `threads: 0` is set in the config+ threads: int = (+ opts.threads+ if opts.threads is not None+ else self.config["threads"].get(int)+ )+ if threads:
self.open_pool(threads)
With it, threads: 0 runs without the pool, threads: 2 still opens it, --threads 0 still overrides, and test/plugins/test_replaygain.py gives 25 passed, 22 skipped locally (the skips are the missing gstreamer/audiotools backends). Happy to open a PR with a test if that's welcome. The docs only mention --threads 0 for disabling parallelism, so it might be worth one line there too.
Hi! I'd like to work on this issue and submit a pull request with a fix and regression test. I'll first verify the behavior on the current main branch. Please let me know if anyone is already working on it.
Activity
obethgeoff10c-ops commentedon Nov 3, 2026
Hi! I'd like to work on this issue and submit a pull request with a fix and regression test. I'll first verify the behavior on the current main branch. Please let me know if anyone is already working on it.