Skip to content

Commit

Permalink
fix: Supress non-UTF8 variables from pilot environment
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisburr committed Feb 28, 2025
1 parent b1a91d5 commit 0462ec1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/DIRAC/WorkloadManagementSystem/Utilities/PilotWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,15 @@
# just logging the environment as first thing
logger.debug('===========================================================')
logger.debug('Environment of execution host\\n')
for key, val in os.environ.items():
for key, val in getattr(os, "environb", os.environ).items():
# Clean the environment of non-utf-8 characters
try:
key = key.decode("utf-8")
val = val.decode("utf-8")
except UnicodeDecodeError as e:
logger.error("Dropping %%s=%%s due to: %%s", key, val, e)
del os.environ[key]
continue
logger.debug(key + '=' + val)
logger.debug('===========================================================\\n')
Expand Down

0 comments on commit 0462ec1

Please sign in to comment.