Skip to content

Commit a4be35b

Browse files
ptooleytelemin
authored andcommitted
QOL fixes for plugin architecture
1 parent f7c1075 commit a4be35b

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

pypop/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def set_paramedir_path(path):
2828
raise ValueError("path must be a string")
2929

3030
_paramedir_path = normpath(expanduser(path))
31-
31+
32+
3233
def set_tmpdir_path(path):
3334
global _tmpdir_path
3435
if not isinstance(path, str):

pypop/trace/prvtrace.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .trace import Trace
1414

1515
from ..utils.io import zipopen
16+
from ..utils.exceptions import WrongLoaderError
1617

1718
from ..dimemas import dimemas_idealise
1819
from ..extrae import paramedir_analyze_any_of, chop_prv_to_roi, remove_trace
@@ -56,8 +57,14 @@
5657
class PRVTrace(Trace):
5758
def _gather_metadata(self):
5859

59-
with zipopen(self._tracefile, "rt") as fh:
60-
headerline = fh.readline().strip()
60+
try:
61+
with zipopen(self._tracefile, "rt") as fh:
62+
headerline = fh.readline().strip()
63+
except IsADirectoryError:
64+
raise WrongLoaderError("Not a valid prv file")
65+
66+
if not headerline.startswith("#Paraver"):
67+
raise WrongLoaderError("Not a valid prv file")
6168

6269
elem = headerline.replace(":", ";", 1).split(":", 4)
6370

pypop/utils/pandas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __enter__(self):
2121
# despatcher
2222
if "does not exist" in str(err):
2323
raise FileNotFoundError('"{}" does not exist'.format(self._filename))
24-
if "HDF5 error" in str(err):
24+
if "HDF5 error" in str(err) or "not a regular file" in str(err):
2525
raise ValueError('"{}" is not a valid HDF5 file'.format(self._filename))
2626
# Reraise anything we don't catch explicitly
2727
raise

0 commit comments

Comments
 (0)