Skip to content

Commit e1edb9e

Browse files
authored
Merge pull request #139 from Imageomics/copilot/fix-138
Fix UTF-8 encoding issues in file operations to prevent Windows crashes and add Windows CI testing
2 parents 187410e + c60564c commit e1edb9e

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.github/workflows/run-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ on: [push]
44

55
jobs:
66
build:
7-
runs-on: ubuntu-latest
7+
runs-on: ${{ matrix.os }}
88

99
strategy:
1010
matrix:
11+
os: [ubuntu-latest, windows-latest]
1112
python-version: ['3.10', '3.11', '3.12', '3.13']
1213

1314
steps:

src/bioclip/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def parse_args(input_args=None):
202202

203203
def create_classes_str(cls_file_path):
204204
"""Reads a file with one class per line and returns a comma separated string of classes"""
205-
with open(cls_file_path, 'r') as cls_file:
205+
with open(cls_file_path, 'r', encoding="utf-8") as cls_file:
206206
cls_str = [item.strip() for item in cls_file.readlines()]
207207
return ",".join(cls_str)
208208

src/bioclip/predict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def get_txt_names(self) -> List[List[str]]:
348348
List[List[str]]: A list of lists, where each inner list contains names corresponding to the text embeddings.
349349
"""
350350
txt_names_json = self.get_cached_datafile("embeddings/txt_emb_species.json")
351-
with open(txt_names_json) as fd:
351+
with open(txt_names_json, encoding="utf-8") as fd:
352352
txt_names = json.load(fd)
353353
return txt_names
354354

0 commit comments

Comments
 (0)