← Back to team overview

sikuli-driver team mailing list archive

[Question #141252]: Execution Error in Java

 

New question #141252 on Sikuli:
https://answers.launchpad.net/sikuli/+question/141252

Hi,

I am executing the following code from one of the post of sikuli but i am getting different error. If i give any sikuli folderi am getting same error

import java.io.File;

import java.io.IOException;

import java.util.Arrays;

import java.util.Iterator;

import java.util.LinkedList;

 

import org.python.util.PythonInterpreter;

 

 

public class MagicClass {

 

private static LinkedList<String> _headers;

 

public static void main(String[] args) throws Exception{

      

String dotSikuliPath = "C:\\Users\\Desktop\\TestingNun.sikuli\\";

  String[] h = new String[]{

           "from sikuli.Sikuli import *",

           "setThrowException(False)",

           "setShowActions(False)"

        }; 

  _headers = new LinkedList<String>(Arrays.asList(h));

  try{

        System.out.println("");

   runPython(dotSikuliPath);

  }catch(Exception e){

   System.err.println(e.toString());

  }

}

 

public static void runPython(String dotSikuliPath) throws IOException{

       PythonInterpreter py = new PythonInterpreter();

       Iterator<String> it = _headers.iterator();

       System.out.println(it);

       while(it.hasNext())

        py.exec(it.next());

          

       py.exec("setBundlePath('" + dotSikuliPath + "')");

       File pyFile = getPyFrom(dotSikuliPath);

       py.execfile(pyFile.getAbsolutePath());

       

    }

 

private static File getPyFrom(String dotSikuliPath) throws IOException{

       String name = new File(dotSikuliPath).getName();

       String prefix = name.substring(0, name.lastIndexOf('.'));

       return new File(dotSikuliPath + "/"+ prefix + ".py");

    }

 

}

 
I installed sikulit exe file and jython for python. I am running for eclipse. I set the all env varaibale for java jdk sikuli

Sikuli vision engine loaded.

Text Recgonizer inited.

Windows utilities loaded.

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\sikuli\Sikuli.py", line 29, in <module>

  File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\sikuli\Region.py", line 7, in <module>

  File "C:\jython2.5.2rc3\Lib\inspect.py", line 31, in <module>

    import sys, os, types, string, re, dis, imp, tokenize, linecache

  File "C:\jython2.5.2rc3\Lib\os.py", line 118, in <module>

    raise ImportError, 'no os specific module found'

ImportError: no os specific module found

Thanks in advance


-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.