move set_locale_encoding() to occur after logging is setup - allows

function to use console_error() directly (https://github.com/AMDResearch/omniperf/pull/308#discussion_r1519914083)

Signed-off-by: Karl W Schulz <karl.schulz@amd.com>
Этот коммит содержится в:
Karl W Schulz
2024-03-11 12:02:31 -05:00
коммит произвёл Karl W. Schulz
родитель 5e21dc35fd
Коммит e85037fdfb
2 изменённых файлов: 6 добавлений и 6 удалений
+1 -2
Просмотреть файл
@@ -58,7 +58,6 @@ SUPPORTED_ARCHS = {
class Omniperf:
def __init__(self):
set_locale_encoding()
self.__args = None
self.__profiler_mode = None
self.__analyze_mode = None
@@ -80,8 +79,8 @@ class Omniperf:
self.__loglevel = setup_logging_priority(
self.__args.verbose, self.__args.quiet, self.__mode
)
setattr(self.__args, "loglevel", self.__loglevel)
set_locale_encoding()
if self.__mode == "profile":
self.detect_profiler()
+5 -4
Просмотреть файл
@@ -603,7 +603,8 @@ def set_locale_encoding():
try:
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
except locale.Error as error:
print("Please ensure that the 'en_US.UTF-8' locale is available on your system.")
print("")
print("ERROR: ", error)
sys.exit(1)
console_error(
"Please ensure that the 'en_US.UTF-8' locale is available on your system.",
exit=False,
)
console_error(error)