sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #29437
Re: [Question #258335]: Windows path variables
Question #258335 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/258335
Status: Open => Answered
RaiMan proposed the following answer:
sorry for my mistake - this works:
localappdata = os.environ.get("LOCALAPPDATA")
programfiles = os.environ.get("PROGRAMFILES")
var1 = r"%s\test1" % localappdata
var2 = r"%s\test2\launcher.exe" % programfiles
If you want to check for path existence, you must use
os.path.exists(var1)
If you want to wait until one or both of the paths exists, you have to
use a waiting loop (Sikuli's exists waits for images to appear on a
screen only).
- until one path exists:
pathOK = False
for i in range(120):
if os.path.exists(var1) or os.path.exists(var2):
pathOK = True
break
wait(1)
- until both path exists:
pathOK = False
for i in range(120):
if os.path.exists(var1) and os.path.exists(var2):
pathOK = True
break
wait(1)
after both loop versions pathOK signals success or not
print "Path check success:", "YES" if pathOK else "NO"
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.