Every line of 'os environ python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
269 def setup_os_environ(self): 270 """ This method is called automatically in Python.__init__; os.environ can 271 be customized on startup via modifying Python.defaults["environment_setup"]. 272 This can be useful for modifying system path only for the duration of the applications run time. 273 Currently this is only used to point to this files directory for SDL2 dll files. """ 274 modes = {"=" : "equals", 275 "+=" : "__add__", # append strings or add ints 276 "-=" : "__sub__", # integer values only 277 "*=" : "__mul__", 278 "/=" : "__div__"} 279 280 for command in self.environment_setup: 281 variable, mode, value = command.split() 282 if modes[mode] == "equals": 283 result = value 284 else: 285 environment_value = os.environ[variable] 286 method = modes[mode] 287 result = getattr(environment_value, method)(value) 288 self.alert("Setting os.environ[{}] = {}".format(variable, result), 289 level=self.verbosity["os_environ_set"]) 290 os.environ[variable] = result 291 assert os.getenv(variable) == result