[How to] get deeper into Python language

Created by RaiMan
Keywords:
Last updated by:
RaiMan

IN ANY CASE: It is helpful, to have at least read across the Sikuli docs: http://sikulix-2014.readthedocs.org/en/latest/index.html

--- As stated in the intro of the docs:
However, if you would like to write more powerful and complex scripts, which might even be structured in modules, you have to dive into the Python Language
(http://www.jython.org/jythonbook/en/1.0/).

--- A very good and straight forward tutorial on Python language (C-Python! see comment below):
http://www.tutorialspoint.com/python/index.htm

--- If you want to have an interactive interpreter in parallel, that is aware of Sikuli features, while going through a tutorial:
on a command line enter:
for 1.0.1: java -jar path-to-sikuli-script.jar -i
for 1.1.0+: java -jar path-to-sikulix.jar -i

(where path-to-... has to be adapted for your situation)

--- Since these are more tutorial kind of docs, as a reference you can use:
Python 2.5: http://docs.python.org/release/2.5/index.html (Language and Library reference + much more)
Jython 2.5.2: http://www.jython.org/docs/index.html

--- DIFFERENCES between Python and Jython (Sikuli):
Always be aware, when using Python documentation, that Sikuli uses the Java based Jython interpreter internally, that especially cannot load any Python modules that are written in C or need C-based API's to the underlying system.

So if something, that might work in Python, produces "name not found" errors (or other errors) in Sikuli/Jython, you have to live with the fact, that it will not be available in Sikuli.

************ the following faqs talk about specific Python aspects

faq 1800: Indentation --- the secrets behind and how to recover
faq 1739: [HowTo] handle \ (backslash) and " (double quotes) in strings
faq 1437: [HowTo] repeat something in a Sikuli script (make loops)
faq 1114: [HowTo] Import user defined Python modules in Sikuli
faq 1804: Sikuli IDE's unit test feature and the alternatives
faq 1778: Logging and reporting in Sikuli scripts