Skip to content

Commit 9daf624

Browse files
oscarlevinCopilot
andauthored
Update pretext/utils.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent fe0ebd9 commit 9daf624

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

pretext/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ def requirements_version(dirpath: Optional[Path] = None) -> Optional[str]:
136136
with open(pp / "requirements.txt", "r") as f:
137137
REGEX = r"\s*pretext(book)?(\[.*\])?\s*==\s*(?P<version>[\d\.]*)\s*"gm
138138
for line in f.readlines():
139-
if re.match(REGEX, line):
140-
return re.match(REGEX, line).group("version")
139+
match = re.match(REGEX, line)
140+
if match:
141+
return match.group("version")
141142
except Exception as e:
142143
log.debug("Could not read `requirements.txt`:")
143144
log.debug(e)

0 commit comments

Comments
 (0)