MCPcopy Create free account
hub / github.com/ActiveState/code / setenviron

Function setenviron

recipes/Python/577454_Extract_expexecute/recipe-577454.py:237–247  ·  view source on GitHub ↗

Set environment variable

(pValue, pFileName)

Source from the content-addressed store, hash-verified

235 subprocess.Popen(lCommand, shell=True)
236
237def setenviron(pValue, pFileName):
238 'Set environment variable'
239 lParts = pValue.split('=')
240 if len(lParts) > 1:
241 lKey = lParts[0]
242 lValue = lParts[1]
243 if lValue.find('{') >= 0:
244 lValue = Do2.ExpandArg(lValue, pFileName, '')
245 os.environ[lKey] = lValue
246 else:
247 os.environ[pValue] = ''
248
249#sys.argv.extend( [ 'c:\\source\\python\\projects\\program execution\\pb.py', '#!Inst', 'A', '{p}' ] )
250#sys.argv.extend( [ 'c:\\source\\python\\projects\\program execution\\pb.py', '#!BadI', 'A', '{p}' ] )

Callers 4

recipe-577454.pyFile · 0.70
recipe-577439.pyFile · 0.50
recipe-577440.pyFile · 0.50
recipe-577441.pyFile · 0.50

Calls 2

splitMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected