Unable to debug sikuli Script in Intellij /pycharm

Asked by Mehrunisa

I have been able to run the sikuli scripts in intellij and pycharm both however when I try to debug It I get the following error

Traceback (most recent call last):
  File "C:\Users\username\.IdeaIC2017.3\config\plugins\python-ce\helpers\pydev\pydevd.py", line 15, in <module>
    from _pydevd_bundle.pydevd_constants import IS_JYTH_LESS25, IS_PY3K, IS_PY34_OR_GREATER, IS_PYCHARM, get_thread_id, \
  File "C:\Users\username\.IdeaIC2017.3\config\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_constants.py", line 155, in <module>
    from _pydev_imps._pydev_saved_modules import thread
  File "C:\Users\username\.IdeaIC2017.3\config\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_saved_modules.py", line 8, in <module>
    import socket
  File "C:\jython2.7.0\Lib\socket.py", line 3, in <module>
    from _socket import (
  File "C:\jython2.7.0\Lib\_socket.py", line 12, in <module>
    from collections import namedtuple, Iterable
ImportError: cannot import name Iterable

Windows 10 64 bit
Intellij community edition 2017.3.4
Sikuli 1.1.2
jython 2.7.1

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Mehrunisa
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
RaiMan (raimund-hocke) said :
#1

check your setup:
you say you have Jython 2.7.1 but the stack trace says:

  File "C:\jython2.7.0\Lib\socket.py", line 3, in <module>
    from _socket import (

Revision history for this message
Mehrunisa (mehrunisa8828) said :
#2

But when I am running the IDE the first line says the below.

C:\jython2.7.1\bin\jython.exe C:\Users\username\.IdeaIC2017.3\config\plugins\python-ce\helpers\pydev\pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 19898 --file C:/Users/username/eclipse-workspace/Testing/src/TEST/__init__.py

When I try to set up the 2.7.0 jython as the interpreter and install the packages I get the following error:
Traceback (most recent call last):
  File "C:\Users\Username\AppData\Local\Temp\tmp1y8vvdpycharm-management\setuptools-28.8.0\setup.py", line 11, in <module>
    import setuptools
  File "C:\Users\Username\AppData\Local\Temp\tmp1y8vvdpycharm-management\setuptools-28.8.0\setuptools\__init__.py", line 10, in <module>
    from setuptools.extern.six.moves import filter, filterfalse, map
  File "C:\Users\Username\AppData\Local\Temp\tmp1y8vvdpycharm-management\setuptools-28.8.0\setuptools\extern\__init__.py", line 1, in <module>
    from pkg_resources.extern import VendorImporter
  File "C:\Users\Username\AppData\Local\Temp\tmp1y8vvdpycharm-management\setuptools-28.8.0\pkg_resources\__init__.py", line 36, in <module>
    import email.parser
  File "C:\jython2.7.0\Lib\email\parser.py", line 12, in <module>
    from email.feedparser import FeedParser
  File "C:\jython2.7.0\Lib\email\feedparser.py", line 27, in <module>
    from email import message
  File "C:\jython2.7.0\Lib\email\message.py", line 16, in <module>
    import email.charset
  File "C:\jython2.7.0\Lib\email\charset.py", line 13, in <module>
    import email.base64mime
  File "C:\jython2.7.0\Lib\email\base64mime.py", line 40, in <module>
    from email.utils import fix_eols
  File "C:\jython2.7.0\Lib\email\utils.py", line 28, in <module>
    import socket
  File "C:\jython2.7.0\Lib\socket.py", line 3, in <module>
    from _socket import (
  File "C:\jython2.7.0\Lib\_socket.py", line 12, in <module>
    from collections import namedtuple, Iterable
ImportError: cannot import name Iterable

Revision history for this message
RaiMan (raimund-hocke) said :
#3

I just made a test on my Mac with Pycharm - works
- PyCharm uses the 2.7.0 interpreter, but my SikuliX is setup with 2.7.1

I had the problem, that the <appdata>/Sikulix/Lib folder contained Jython stuff.
I deleted the folder and ran a PythonConsole in PyCharm with these additional startup lines:
import org.sikuli.script.SikulixForJython
from sikuli import *

this restored the Lib folder.

This PythonConsole is helpful to do some quick checks or run a script.

After stopping and restarting PyCharm it worked.

In my run configuration for the project I have a pointer to sikulixapi.jar in the EnvVariables field

Revision history for this message
Mehrunisa (mehrunisa8828) said :
#4

That totally worked Raiman ! thanks for the solution.

Revision history for this message
Mehrunisa (mehrunisa8828) said :
#5

Thanks RaiMan, that solved my question.

Revision history for this message
Mehrunisa (mehrunisa8828) said :
#6

I am also trying to make selenium work with sikuli scripts in the pycharm. any ideas about how to do it ?

Revision history for this message
RaiMan (raimund-hocke) said :
#7
Revision history for this message
Mehrunisa (mehrunisa8828) said :
#8

Thankyou RAiman it actually worked!