Skip to content

Commit b73f217

Browse files
committed
BF: Don't fail if etelemetry.get_project returns None
main.workflow() crashes with a TypeError when logging the latest version if "NO_ET" is in os.environ because etelemetry.get_project() returns None. Guard against this failure as well the KeyError that would be triggered if get_project(), for whatever reason, returns a dictionary without a "version" key.
1 parent 711d403 commit b73f217

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

heudiconv/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,16 @@ def workflow(*, dicom_dir_template=None, files=None, subjs=None,
252252

253253
outdir = op.abspath(outdir)
254254

255+
latest = None
255256
try:
256257
import etelemetry
257258
latest = etelemetry.get_project("nipy/heudiconv")
258259
except Exception as e:
259260
lgr.warning("Could not check for version updates: %s", str(e))
260-
latest = {"version": 'Unknown'}
261261

262262
lgr.info(INIT_MSG(packname=__packagename__,
263263
version=__version__,
264-
latest=latest["version"]))
264+
latest=(latest or {}).get("version", "Unknown")))
265265

266266
if command:
267267
process_extra_commands(outdir, command, files, dicom_dir_template,

0 commit comments

Comments
 (0)