From cd3c85554b5487d1030e058bfb13f2503a40579e Mon Sep 17 00:00:00 2001 From: Nitzan Raz Date: Wed, 25 Sep 2024 12:41:49 +0300 Subject: [PATCH] Auto Instrumentation sitecustomize: allowing unset PYTHONPATH For edge cases where PYTHONPATH is not set at all --- .../instrumentation/auto_instrumentation/sitecustomize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py index 912675f1b7..68ef972d02 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py @@ -29,7 +29,7 @@ def initialize(): # prevents auto-instrumentation of subprocesses if code execs another python process environ["PYTHONPATH"] = _python_path_without_directory( - environ["PYTHONPATH"], dirname(abspath(__file__)), pathsep + environ.get("PYTHONPATH", ""), dirname(abspath(__file__)), pathsep ) try: