Skip to content

Commit 2e4f921

Browse files
authored
rf(py314): Replace deprecated pkgutil.find_loader (#3384)
This PR removes [pkgutil.find_loader()][] and replaces it with [importlib.util.find_spec()][]. `find_loader` was deprecated in Python 3.12 and will be removed in 3.14. `find_spec` has been present since Python 3.4. Both functions return `None` if the module loader cannot be found. For its use in this project, this is sufficient and no translation of the return value is needed. [pkgutil.find_loader()]: https://docs.python.org/3/library/pkgutil.html#pkgutil.get_loader [importlib.util.find_spec()]: https://docs.python.org/3/library/importlib.html#importlib.util.find_spec
2 parents 5d7a6d3 + bf38d9e commit 2e4f921

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fmriprep/cli/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,9 @@ def parse_args(args=None, namespace=None):
794794
config.from_dict(vars(opts), init=['nipype'])
795795

796796
if not config.execution.notrack:
797-
import pkgutil
797+
import importlib.util
798798

799-
if pkgutil.find_loader('sentry_sdk') is None:
799+
if importlib.util.find_spec('sentry_sdk') is None:
800800
config.execution.notrack = True
801801
config.loggers.cli.warning('Telemetry disabled because sentry_sdk is not installed.')
802802
else:

0 commit comments

Comments
 (0)