diff --git a/utils_maintenance/autopep8_format_paths.py b/utils_maintenance/autopep8_format_paths.py
index a5647b770650cc3d75b47def8c559f4cc9efedce..c0eb367780f4d3e6ddf5911328ded3079eadef71 100755
--- a/utils_maintenance/autopep8_format_paths.py
+++ b/utils_maintenance/autopep8_format_paths.py
@@ -68,6 +68,7 @@ def autopep8_ensure_version(autopep8_format_cmd_argument):
global AUTOPEP8_FORMAT_CMD
autopep8_format_cmd = None
version_output = None
+ version = None
# Attempt to use `--autopep8-command` passed in from `make format`
# so the autopep8 distributed with Blender will be used.
for is_default in (True, False):
@@ -90,7 +91,8 @@ def autopep8_ensure_version(autopep8_format_cmd_argument):
continue
AUTOPEP8_FORMAT_CMD = autopep8_format_cmd
break
- version = next(iter(v for v in version_output.split() if v[0].isdigit()), None)
+ if version_output is not None:
+ version = next(iter(v for v in version_output.split() if v[0].isdigit()), None)
if version is not None:
version = version.split("-")[0]
version = tuple(int(n) for n in version.split("."))