Read env vars via os.getenv instead of os.environ

This commit is contained in:
huchukato
2026-09-25 10:36:15 +02:00
parent 1cf1612132
commit dda94d0f2d
2 changed files with 10 additions and 10 deletions
+8 -8
View File
@@ -21,7 +21,7 @@ def detect_cloud_environment():
# Check environment variables
for indicator in cloud_indicators:
if indicator in os.environ:
if os.getenv(indicator) is not None:
print(f"🌩️ Detected cloud environment: {indicator}")
# Check CUDA version - only disable CUDA graph for CUDA 12
@@ -86,7 +86,7 @@ def _auto_install_tensorrt():
This function installs only the TensorRT packages via pip.
A marker file prevents repeated install attempts on every ComfyUI startup.
"""
disable_auto_install = os.environ.get("DISABLE_TENSORRT_AUTO_INSTALL", "false").lower() == "true"
disable_auto_install = os.getenv("DISABLE_TENSORRT_AUTO_INSTALL", "false").lower() == "true"
if disable_auto_install:
print("[ComfyUI-RIFE-TensorRT] Auto-installation disabled via DISABLE_TENSORRT_AUTO_INSTALL")
return True
@@ -153,8 +153,8 @@ def _auto_install_tensorrt():
pass
# Try CUDA_PATH
if not cuda_version and os.environ.get("CUDA_PATH"):
nvcc_path = os.path.join(os.environ["CUDA_PATH"], "bin", "nvcc")
if not cuda_version and os.getenv("CUDA_PATH"):
nvcc_path = os.path.join(os.getenv("CUDA_PATH"), "bin", "nvcc")
if os.path.exists(nvcc_path):
try:
stdout = subprocess.check_output([nvcc_path, "--version"], text=True)
@@ -166,8 +166,8 @@ def _auto_install_tensorrt():
pass
# Try CUDA_HOME
if not cuda_version and os.environ.get("CUDA_HOME"):
nvcc_path = os.path.join(os.environ["CUDA_HOME"], "bin", "nvcc")
if not cuda_version and os.getenv("CUDA_HOME"):
nvcc_path = os.path.join(os.getenv("CUDA_HOME"), "bin", "nvcc")
if os.path.exists(nvcc_path):
try:
stdout = subprocess.check_output([nvcc_path, "--version"], text=True)
@@ -250,11 +250,11 @@ def _setup_cuda_dll_path():
cuda_root = None
# Check for CUDA_PATH or CUDA_HOME environment variables
cuda_root = os.environ.get("CUDA_PATH") or os.environ.get("CUDA_HOME")
cuda_root = os.getenv("CUDA_PATH") or os.getenv("CUDA_HOME")
if not cuda_root:
# Try default Windows install location
program_files = os.environ.get("PROGRAMFILES")
program_files = os.getenv("PROGRAMFILES")
if program_files:
cuda_base = Path(program_files) / "NVIDIA GPU Computing Toolkit" / "CUDA"
if cuda_base.exists():
+2 -2
View File
@@ -38,7 +38,7 @@ def detect_cuda_version():
return version
# Try CUDA_PATH
cuda_path = os.environ.get("CUDA_PATH")
cuda_path = os.getenv("CUDA_PATH")
if cuda_path:
nvcc_path = os.path.join(cuda_path, "bin", "nvcc")
if os.path.exists(nvcc_path):
@@ -51,7 +51,7 @@ def detect_cuda_version():
return version
# Try CUDA_HOME
cuda_home = os.environ.get("CUDA_HOME")
cuda_home = os.getenv("CUDA_HOME")
if cuda_home:
nvcc_path = os.path.join(cuda_home, "bin", "nvcc")
if os.path.exists(nvcc_path):