Skip to content

Commit

Permalink
fix(e2e_reader.py): makes exception formatting compatible with python…
Browse files Browse the repository at this point in the history
… < 3.10
  • Loading branch information
Oli4 committed Mar 17, 2023
1 parent ea1cb4c commit 2c4cbb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/eyepy/core/eyeenface.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class EyeEnface:
""" """

def __init__(self, data: npt.NDArray[np.int_],
meta: EyeEnfaceMeta) -> None:
meta: "EyeEnfaceMeta") -> None:
"""
Args:
Expand Down
6 changes: 5 additions & 1 deletion src/eyepy/io/he/e2e_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from io import BufferedReader
import logging
from pathlib import Path
import sys
from textwrap import indent
import traceback
from typing import Any, Dict, List, Optional, Tuple, Union
Expand Down Expand Up @@ -928,7 +929,10 @@ def volume(self) -> EyeVolume:
try:
return s.get_volume()
except Exception as e:
logger.debug("".join(traceback.format_exception(e)))
# for compatibility with python <= 3.9, later work with only the exception as argument for format_exception
exc_type, exc_value, exc_tb = sys.exc_info()
logger.debug("".join(
traceback.format_exception(exc_type, exc_value, exc_tb)))
raise ValueError(
"No Series in the E2E file can be parsed to a an EyeVolume object. You might be able to extract information manually from the E2ESeries objects (e2ereader.series)"
)
Expand Down

0 comments on commit 2c4cbb0

Please sign in to comment.