Skip to content

Commit

Permalink
Merge pull request #53 from kamo-naoyuki/fix52
Browse files Browse the repository at this point in the history
fix #52:   kaldiio/matio.py
  • Loading branch information
kamo-naoyuki authored Dec 10, 2020
2 parents fb9d4db + 724cc9b commit bf117bc
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions kaldiio/matio.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,23 @@ def _parse_arkpath(ark_name):
return ark_name, None, None

slices = None
if ":" in ark_name:
fname, offset = ark_name.split(":", 1)
if "[" in offset and "]" in offset:
offset, Range = offset.split("[")
# Range = [3:6, 10:30]
Range = Range.replace("]", "").strip()
if "[" in ark_name and "]" in ark_name:
_ark_name, Range = ark_name.split("[")
Range = Range.replace("]", "").strip()
try:
slices = _convert_to_slice(Range)
offset = int(offset)
except Exception:
pass
else:
ark_name = _ark_name

if ":" in ark_name:
fname, offset = ark_name.rsplit(":", 1)
try:
offset = int(offset)
except TypeError:

This comment has been minimized.

Copy link
@horsti371

horsti371 Dec 10, 2020

@kamo-naoyuki Should be ValueError instead of TypeError to fix @ #52

This comment has been minimized.

Copy link
@kamo-naoyuki

kamo-naoyuki Dec 10, 2020

Author Contributor

sorry

fname = ark_name
offset = None
else:
fname = ark_name
offset = None
Expand Down

0 comments on commit bf117bc

Please sign in to comment.