Skip to content

Commit

Permalink
fix: more specific missing directory errors
Browse files Browse the repository at this point in the history
  • Loading branch information
YodaEmbedding committed Aug 16, 2023
1 parent 2f9884d commit d60f6cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compressai/datasets/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, root, transform=None, split="train"):
splitdir = Path(root) / split

if not splitdir.is_dir():
raise RuntimeError(f'Invalid directory "{root}"')
raise RuntimeError(f'Missing directory "{splitdir}"')

self.samples = sorted(f for f in splitdir.iterdir() if f.is_file())

Expand Down
5 changes: 2 additions & 3 deletions compressai/datasets/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


import random

from pathlib import Path
Expand Down Expand Up @@ -91,10 +90,10 @@ def __init__(
splitdir = Path(f"{root}/sequences")

if not splitfile.is_file():
raise RuntimeError(f'Invalid file "{root}"')
raise RuntimeError(f'Missing file "{splitfile}"')

if not splitdir.is_dir():
raise RuntimeError(f'Invalid directory "{root}"')
raise RuntimeError(f'Missing directory "{splitdir}"')

with open(splitfile, "r") as f_in:
self.sample_folders = [Path(f"{splitdir}/{f.strip()}") for f in f_in]
Expand Down

0 comments on commit d60f6cb

Please sign in to comment.