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>


[ROCm/rocprofiler-compute commit: e85037fdfb]
This commit is contained in:
Karl W Schulz
2024-03-11 12:02:31 -05:00
committed by Karl W. Schulz
parent 6b0a36cb27
commit 28f027c7bf
2 changed files with 6 additions and 6 deletions
@@ -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()
@@ -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)