diff --git a/swh/loader/git/from_disk.py b/swh/loader/git/from_disk.py --- a/swh/loader/git/from_disk.py +++ b/swh/loader/git/from_disk.py @@ -9,7 +9,7 @@ import shutil from typing import Dict, Optional -from dulwich.errors import ObjectFormatException, EmptyFileException +from dulwich.errors import ObjectFormatException from collections import defaultdict from swh.model import hashutil @@ -90,6 +90,13 @@ The object if found without malformation """ + + try: + from dulwich.errors import EmptyFileException + except ImportError: + # dulwich >= 0.20 + from dulwich.objects import EmptyFileException + try: # some errors are raised when reading the object obj = self.repo[oid]