os.getenv is not getting new variable settings each time it is called
I'm trying to reset System environment variables for a string of tests (one starting after another. After each test several System environment variables need to be changed before next test is run... using the following code:
from sikuli import *
import os
def exeCmd(title,cmd):
App.open('CMD /k start \"'+title+'\" '+cmd)
exeCmd ("env1"
Var1 = os.getenv('Var1')
Var2 = os.getenv('Var2')
print Var1
print Var2
wait (10)
exeCmd ("env1"
Var1 = os.getenv('Var1')
Var2 = os.getenv('Var2')
print Var1
print Var2
System1.bat and System 2.bat each use respectively:
Setx Var1 system1a /M
Setx Var2 system1b /M
exit
Setx with /M should set System wide environment variables and os.getenv should force retrieval of these variables.
However both print statements have the same values which are for system1.
I need to use System Environment variables because each test launches external applications that utilizes them.
I am fairly new to Sikuli
Thanks in advance.
-Justin
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Justin Pinkham for more information if necessary.