@@ -354,7 +354,7 @@ def get_version_from_chart_yaml(path: Path) -> Version | None:
354354def get_version_from_setup_py (path : Path ) -> Version | None :
355355 setup_py_path = path / "setup.py"
356356 if setup_py_path .exists ():
357- with setup_py_path .open (encoding = "utf-8" ) as f :
357+ with setup_py_path .open (encoding = "utf-8" , errors = "replace" ) as f :
358358 setup_data = f .read ()
359359 if res := re .search (r"version=['\"]([^'\"]+)['\"]" , setup_data ):
360360 try :
@@ -413,7 +413,7 @@ def get_version_from_cargo_toml(directory_path: Path) -> Version | None:
413413def get_version_from_version_file (path : Path ) -> Version | None :
414414 version_path = path / "VERSION"
415415 if version_path .exists ():
416- with version_path .open (encoding = "utf-8" ) as f :
416+ with version_path .open (encoding = "utf-8" , errors = "replace" ) as f :
417417 version = f .read ().strip ()
418418 try :
419419 return Version .from_str (version )
@@ -425,7 +425,7 @@ def get_version_from_version_file(path: Path) -> Version | None:
425425def get_version_from_version_txt (path : Path ) -> Version | None :
426426 version_txt_path = path / "VERSION.txt"
427427 if version_txt_path .exists ():
428- with version_txt_path .open (encoding = "utf-8" ) as f :
428+ with version_txt_path .open (encoding = "utf-8" , errors = "replace" ) as f :
429429 version = f .read ().strip ()
430430 try :
431431 return Version .from_str (version )
@@ -437,7 +437,7 @@ def get_version_from_version_txt(path: Path) -> Version | None:
437437def get_version_from_build_gradle_kts (path : Path ) -> Version | None :
438438 build_gradle_kts_path = path / "build.gradle.kts"
439439 if build_gradle_kts_path .exists ():
440- with build_gradle_kts_path .open (encoding = "utf-8" ) as f :
440+ with build_gradle_kts_path .open (encoding = "utf-8" , errors = "replace" ) as f :
441441 content = f .read ()
442442 if res := re .search (r'version\s*=\s*"([^"]+)"' , content ):
443443 try :
@@ -918,7 +918,7 @@ def update_file(filename: str, search_pattern: str | None, replace_text: str, ve
918918 return
919919 if verbose > 0 :
920920 console .print (f"Updating { file_path } " )
921- with file_path .open (encoding = "utf-8" ) as f :
921+ with file_path .open (encoding = "utf-8" , errors = "replace" ) as f :
922922 content = f .read ()
923923 new_content = re .sub (search_pattern , replace_text , content ) if search_pattern else replace_text
924924 if show_diff :
@@ -935,7 +935,7 @@ def update_cargo_toml_version(filename: str, next_version_str: str, verbose: int
935935 if verbose > 0 :
936936 console .print (f"Updating { file_path } " )
937937
938- with file_path .open (encoding = "utf-8" ) as f :
938+ with file_path .open (encoding = "utf-8" , errors = "replace" ) as f :
939939 content = f .read ()
940940
941941 # Use regex to match version in [package] section only
0 commit comments