OCI CLI Fails If Environment Variables "LC_ALL" and "LANG" Is Not Set
Applies to
Oracle Cloud Infrastructure
Linux x86-64
Symptoms
Accessing OCI Bucket using oci cli works on interactive session but fail if run from cron with error:
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/python3/ for mitigation steps.
Cause
OCI CLI is a Python3 script that uses Click.
Click requires "LC_ALL" and "LANG" environment variables to be set.
Solution
Define the environment variable in the script run by cron.
For example, if using bash, use:
#!/bin/bash export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8
Tagged:
0