Sikuli can't import YAML module?

Asked by Milteven on 2016-12-26

Hello, I'm using the Sikuli IDE and trying to import a module named yaml but the console shows this error:

[error] script [ OCReConversorDeString ] stopped with error in line 1
[error] ImportError ( No module named yaml )

"yaml" is in the list of modules on python shell, I'm not a programmer, so maybe I am doing something wrong, this is the script i'm trying to run:

import yaml
Settings.OcrTextRead = True

reg = selectRegion()
print reg.text()

Thank you for your attention, have a good day!

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2016-12-26
Last query:
2016-12-26
Last reply:
2016-12-26
Best RaiMan (raimund-hocke) said : #1

For SikuliX scripts you can use the Python scripting language (level 2.7), but internally as interpreter we use the Java based Jython.

Modules available for Python (C based Python) are only uaseable, if they are completely written in Python language (no C-based or even native code based parts).

Since Python YAML (https://pypi.python.org/pypi/PyYAML/3.12) relies on a C-based library, it cannot be used as is in SikuliX.

You might try this solution:
https://pypi.python.org/pypi/PyYAML/3.12

on Windows you have to download the zipped source from https://pypi.python.org/pypi/PyYAML/3.12, unzip it and run the setup as mentioned.

To run jython from a commandline use:
java -cp <path-to>/sikulix.jar org.python.util.jython setup.py ...

Milteven (milteven12) said : #2

Thanks RaiMan, that solved my question.