← Back to team overview

sikuli-driver team mailing list archive

[Question #224178]: ScriptRunner.runPython(<utf-8 String>) or addTempHeader(<utf-8 String>)

 

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

If the path to the sikuli files contains UTF8 chars the ScriptRunner throws an exception:
ScriptRunner.runPython(<path with utf8 chars>)

I've got the same error when I'm adding some temp header to the ScriptRunner containing UTF-8 chars:
scriptRunner.addTempHeader("s = \"asdsadüasd\"");

This is the error message:
  File "<string>", line None
SyntaxError: Illegal character in file '<string>' for encoding 'utf-8'

The problem is described here:
http://sourceforge.net/mailarchive/message.php?msg_id=30247025

and i solved it by executing the temp header lines in the ScriptRunner.java that way:
it = _tmp_headers.iterator();
while(it.hasNext()){
        String line = it.next();

        // java utf16 string to utf8 for python
  	ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(line.getBytes());
  	py.execfile(byteArrayInputStream);
  	byteArrayInputStream.close();
}

Might be good to add these 3 lines to the Sikuli code.

with best regards 
Neiko




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