Skip to content

Commit 3a5403f

Browse files
committed
Fix encoding issue
1 parent 72038bc commit 3a5403f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/superannotate/lib/app/interface/sdk_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ def create_annotation_classes_from_classes_json(
12771277
file.seek(0)
12781278
data = file
12791279
else:
1280-
data = open(classes_json)
1280+
data = open(classes_json, encoding="utf-8")
12811281
classes_json = json.load(data)
12821282
try:
12831283
annotation_classes = parse_obj_as(List[AnnotationClassEntity], classes_json)

src/superannotate/lib/core/usecases/annotations.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ async def get_annotation(
532532
if self._project.type == constants.ProjectType.PIXEL.value:
533533
mask = self.get_annotation_from_s3(self._client_s3_bucket, mask_path)
534534
else:
535-
async with aiofiles.open(path) as file:
535+
async with aiofiles.open(path, encoding="utf-8") as file:
536536
content = await file.read()
537537
if self._project.type == constants.ProjectType.PIXEL.value:
538538
async with aiofiles.open(mask_path, "rb") as mask:
@@ -835,7 +835,9 @@ def _get_annotation_json(self) -> tuple:
835835
),
836836
)
837837
else:
838-
annotation_json = json.load(open(self._annotation_path))
838+
annotation_json = json.load(
839+
open(self._annotation_path, encoding="utf-8")
840+
)
839841
if self._project.type == constants.ProjectType.PIXEL.value:
840842
mask = open(
841843
self._annotation_path.replace(
@@ -1313,7 +1315,7 @@ def download_annotation_classes(self, path: str):
13131315
if response.ok:
13141316
classes_path = Path(path) / "classes"
13151317
classes_path.mkdir(parents=True, exist_ok=True)
1316-
with open(classes_path / "classes.json", "w+") as file:
1318+
with open(classes_path / "classes.json", "w+", encoding="utf-8") as file:
13171319
json.dump(
13181320
[
13191321
i.dict(

0 commit comments

Comments
 (0)