Skip to content

Commit 0b5b20d

Browse files
committed
Robust import of distutils submodule (fix #2376)
This would fail if the `spawn` module in the `distutils` package was not already imported somewhere else.
1 parent 6b9d766 commit 0b5b20d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

beetsplug/absubmit.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import subprocess
2525
import tempfile
2626

27-
import distutils
27+
from distutils.spawn import find_executable
2828
import requests
2929

3030
from beets import plugins
@@ -79,9 +79,10 @@ def __init__(self):
7979
# Extractor found, will exit with an error if not called with
8080
# the correct amount of arguments.
8181
pass
82-
# Get the executable location on the system,
83-
# needed to calculate the sha1 hash.
84-
self.extractor = distutils.spawn.find_executable(self.extractor)
82+
83+
# Get the executable location on the system, which we need
84+
# to calculate the SHA-1 hash.
85+
self.extractor = find_executable(self.extractor)
8586

8687
# Calculate extractor hash.
8788
self.extractor_sha = hashlib.sha1()

0 commit comments

Comments
 (0)