Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitri-yatsenko committed Sep 16, 2024
1 parent 57c59e5 commit c650765
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions datajoint/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .table import Table, FreeTable
from .heading import Heading
from .declare import EXTERNAL_TABLE_ROOT
from . import s3
from . import s3, errors
from .utils import safe_write, safe_copy

logger = logging.getLogger(__name__.split(".")[0])
Expand Down Expand Up @@ -141,7 +141,12 @@ def _download_buffer(self, external_path):
if self.spec["protocol"] == "s3":
return self.s3.get(external_path)
if self.spec["protocol"] == "file":
return Path(external_path).read_bytes()
try:
return Path(external_path).read_bytes()
except FileNotFoundError:
raise errors.MissingExternalFile(
f"Missing external file {external_path}"
) from None
assert False

def _remove_external_file(self, external_path):
Expand Down

0 comments on commit c650765

Please sign in to comment.