I work in both a Windows 7 and 10 environment and the file locations don't match up. I'm trying to write a Sikuli script that will go in, check which Windows version is being used (7 or 10) and then proceed. I attempted to use:

import os
if os.name == 'nt':
print "windows10"
print "windows7"

but I'm honestly stuck, what's the easiest way to go about this? Any information will help! Attempted to use this as well but my results are java or Java. Maybe I'm not implementing it right?

import os
print os.name 
# result = java
import platform
print platform.system()
#result = Java

Since with SikuliX you are running inside the Java environment, you have to ask the Java environment, where it is running on ;-)

try this:

import java.lang.System as JS
print JS.getProperty("os.name");
print JS.getProperty("os.version");

on my Windows 10 it tells me

Windows 10

All the best. RaiMan from SikuliX ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.