How to Debug your Sikuli script in an advanced debugging IDE such as pyCharm

Asked by dpel

64bit Windows7, Sikuli r930:

Hello,

I am wanting to be able to debug sikuli code in an ide that allows me to do advanced debugging (examine variables at runtime, etc.) Unfortunately this cannot be done automatically in the Sikuli IDE.

My script is running successfully in the pyCharm development IDE; however, when I try to debug it in same ide, I receive this error:

--------------------------------------------------------------------
C:\jython2.5.3\jython.bat "-Dpython.path=T:\Program Files\Sikuli-r930-win32\Sikuli-IDE\libs;T:\Documents\Dropbox\projects_dev\sikuli\uswb.sikuli;T:\Documents\Dropbox\projects_dev\sikuli\uswb.sikuli\org;C:\jython2.5.3\Lib; T:\Program Files\Sikuli-r930-win32\Sikuli-IDE\sikuli-script.jar\Lib" "T:\Program Files (x86)\JetBrains\PyCharm 2.6.2\helpers\pydev\pydevd.py" --multiproc --client 127.0.0.1 --port 50258 --file T:/Documents/Dropbox/projects_dev/sikuli/uswb.sikuli/uswb.py
pydev debugger: process 14776 is connecting
Connected to pydev debugger (build 121.224)
Traceback (most recent call last):
  File "T:\Program Files (x86)\JetBrains\PyCharm 2.6.2\helpers\pydev\pydevd.py", line 1457, in <module>
    debugger.run(setup['file'], None, None)
  File "T:\Program Files (x86)\JetBrains\PyCharm 2.6.2\helpers\pydev\pydevd.py", line 1103, in run
    pydev_imports.execfile(file, globals, locals) #execute the script
  File "T:/Documents/Dropbox/projects_dev/sikuli/uswb.sikuli/uswb.py", line 7, in <module>
    from sikuli.Sikuli import *
  File "T:\Program Files\Sikuli-r930-win32\Sikuli-IDE\sikuli-script.jar\Lib\sikuli\__init__.py", line 3, in <module>
  File "T:\Program Files\Sikuli-r930-win32\Sikuli-IDE\sikuli-script.jar\Lib\sikuli\Sikuli.py", line 16, in <module>
ImportError: No module named __main__

Process finished with exit code -1
--------------------------------------------------------------------

Any help is appreciated.

Another question is Sikuli X r930 the latest? The website mentions -- "Latest version: X 1.0 rc3 (r930)",
although no X 1.0rc3 is shown save for r905.

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

--- latest version is r930 ...
... as noted and downloadable from the download page http://sikuli.org/download.shtml

--- import Sikuli ...
recommended import statement now:
from sikuli import *

--- according pyCharm: I have no idea, what the problem might be. Check the Debug setup again.
Try to run it with
from sikuli import *
commented out and set a breakpoint before the first time a Sikuli feature is used (which would need the import sikuli).
So you can check wether it is a general debugger problem, or has something to do with the Sikuli import.

Revision history for this message
David Pérez (david-perez-ingeniero) said :
#2

I would use PyDev + Eclipse.
As far as I know, debugging Jython is not supported by JetBrains products (PyCharM, IDEA, ...)

Can you help with this problem?

Provide an answer of your own, or ask dpel for more information if necessary.

To post a message you must log in.