assigning to os.environ does not clear the environment


ID: python-best-practices/os-environ-no-assign

Language: Python

Severity: Error

Category: Error Prone


Assigning to os.environ does not clear the environment. To clear the environment, use os.environ.clear()

Non-Compliant Code Examples

import os

os.environ = {}  # use os.environ.clear

Compliant Code Examples

import os

os.environ.clear() jetbrains

Seamless integrations. Try Datadog Code Analysis