[1.0.1] Win7 64: IDE: I get a typeError from NetBeans 7.4 using bundled Jython 2.5.1 --- use 2.5.4 or 2.7

Asked by Rod Caverly

I have a brand new project defined as Python -> Jython 2.5.1 platform

In the Platform Manager
Main tab -> Jython 2.5.1
Python tab -> added c:\SikuliX\sikuli-script.jar\Lib
Java tab -> added c:\SikuliX\sikuli-script.jar

This is my project ...

# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
from sikuli.Sikuli import *
__author__="rod"
__date__ ="$Feb 6, 2014 2:19:05 PM$"

if __name__ == "__main__":
    print "Hello World"

Running the project I get ....
Traceback (most recent call last):
  File "C:\Users\rod\Documents\NetBeansProjects\NewPythonProject4\src\newpythonproject4.py", line 4, in <module>
    from sikuli.Sikuli import *
  File "C:\SikuliX\sikuli-script.jar\Lib\sikuli\__init__.py", line 6, in <module>
TypeError: log(): 1st arg can't be coerced to String

Debugging the project I get .....
[LOG]PythonDebugger : overall Starting
[LOG]PythonDebugger.taskStarted : I am Starting a new Debugging Session ...
[LOG]This window is an interactive debugging context aware Python Shell
[LOG]where you can enter python console commands while debugging
>>>c:\users\rod\appdata\roaming\netbeans\7.4\config\nbpython\debug\nbpythondebug\jpydaemon.py
args = ['C:\\Users\\rod\\AppData\\Roaming\\NetBeans\\7.4\\config\\nbPython\\debug\\nbpythondebug\\jpydaemon.py', 'localhost', '29100']
localDebuggee= None
JPyDbg connecting localhost on in= 29100 /out= 29101
JPyDbgI0001 : connected to localhost
>>>log(): 1st arg can't be coerced to String['Traceback (most recent call last):
deamon ended
', ' File "C:/Users/rod/Documents/NetBeansProjects/NewPythonProject4/src/newpythonproject4.py", line 4, in <module>

    from sikuli.Sikuli import *
', ' File "C:\\SikuliX\\sikuli-script.jar\\Lib\\sikuli\\__init__.py", line 6, in <module>
', "TypeError: log(): 1st arg can't be coerced to String
"]
Debug session normal end

not getting past the "from sikuli.Sikuli import *" is a show stopper...I have poured over the Sikuli.org site, tried to use C:\SikuliX\sikului-ide.jar and C:\SikuliX\sikului-java.jar in various combinations, and I get the same result every time. Any insight is appreciated.

Thank you, Rod

Question information

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

what version of Sikuli?

Revision history for this message
Test (c4456517) said :
#2

@RaiMan - He mentioned Sikuli 1.0.1 in the title. :P

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

@ Test: thanks ;-)

Revision history for this message
RaiMan (raimund-hocke) said :
#4
Revision history for this message
Rod Caverly (rodcaverly) said :
#5

I have followed the steps in 243487 and still donot have a Netbeans working project.  Maybe you can see some configuration detail that I have missed...

Here is the frustrating part... On my personal Win-7 32-bit laptop running Sikuli Maltipoo with NetBeans 7.4, I can run the instruction "from sikuli.Sikuli import *"

The machine I am having trouble with is brand new Dell with an Intel I-5, 12Gig ram, clean Win 7 Professional 64-bit

Any suggestions are welcome.

On Friday, February 7, 2014 4:46 AM, RaiMan <email address hidden> wrote:

Your question #243487 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/243487

Summary changed to:
[1.0.1] Win7 64:  IDE: I get a typeError from NetBeans 7.4

--
You received this question notification because you asked the question.

Revision history for this message
Rod Caverly (rodcaverly) said :
#6

Hi RaiMan,

Here is a new development.  I have downloaded Eclipse and PyDev onto my Win7 64 bit still with the Sikuli 1.0.1 install and when I test the "from sikuli.Sikuli import *" ... this is what I get in Eclipse's Console

pydev debugger: starting
Traceback (most recent call last):
  File "C:\Users\rod\.eclipse\org.eclipse.platform_4.3.0_1709980481_win32_win32_x86_64\plugins\org.python.pydev_3.3.3.201401272249\pysrc\pydevd.py", line 1738, in <module>
    debugger.run(setup['file'], None, None)
  File "C:\Users\rod\.eclipse\org.eclipse.platform_4.3.0_1709980481_win32_win32_x86_64\plugins\org.python.pydev_3.3.3.201401272249\pysrc\pydevd.py", line 1355, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Users\rod\workspace\sikulitest\main.py", line 6, in <module>
    from sikuli.Sikuli import *
  File "C:\SikuliX\Lib\sikuli\__init__.py", line 6, in <module>
    Debug.log(3,"Jython: sikuli: __init__: entering")
TypeError: log(): 1st arg can't be coerced to String

please help.

On Friday, February 7, 2014 8:46 AM, Rod Caverly <email address hidden> wrote:

I have followed the steps in 243487 and still donot have a Netbeans working project.  Maybe you can see some configuration detail that I have missed...

Here is the frustrating part... On my personal Win-7 32-bit laptop running Sikuli Maltipoo with NetBeans 7.4, I can run the instruction "from sikuli.Sikuli import *"

The machine I am having trouble with is brand new Dell with an Intel I-5, 12Gig ram, clean Win 7 Professional 64-bit

Any suggestions are welcome.

On Friday, February 7, 2014 4:46 AM, RaiMan <email address hidden> wrote:

Your question #243487 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/243487

Summary changed to:
[1.0.1] Win7 64:  IDE: I get a typeError from NetBeans 7.4

--
You received this question notification because you asked the question.

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

what about comment #4?

did you read that and went through it step by step?

Revision history for this message
Rod Caverly (rodcaverly) said :
#8

Yes, I studied the

Special information on using Jython in IDEs like Eclipse or running your own Jython
(since 1.0.1)
and tried each step of the instructions including

"import org.sikuli.basics.SikuliXforJython
from sikuli import *"

See attached result...

On Friday, February 7, 2014 10:33 AM, RaiMan <email address hidden> wrote:

Your question #243487 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/243487

    Status: Open => Needs information

RaiMan requested more information:
what about comment #4?

did you read that and went through it step by step?

--
To answer this request for more information, you can either reply to
this email or enter your reply at the following page:
https://answers.launchpad.net/sikuli/+question/243487

You received this question notification because you asked the question.

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

no attachments possible here.

Please run with JVM option -Dsikuli.Debug=3 and send the output silently to my mail at https://launchpad.net/~raimund-hocke

Revision history for this message
Rod Caverly (rodcaverly) said :
#10

please provide more instructions on running JVM with the option requested.  I applied the parameter in Java Runtime, but where does the output go?

On Friday, February 7, 2014 12:22 PM, RaiMan <email address hidden> wrote:

Your question #243487 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/243487

    Status: Open => Answered

RaiMan proposed the following answer:
no attachments possible here.

Please run with JVM option -Dsikuli.Debug=3 and send the output silently
to my mail at https://launchpad.net/~raimund-hocke

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/sikuli/+question/243487/+confirm?answer_id=8

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/sikuli/+question/243487

You received this question notification because you asked the question.

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

in your project settings run section you have an entry field VM Options.
There you enter Java runtime options like -D...

Revision history for this message
Rod Caverly (rodcaverly) said :
#12

Hi RaiMan,

I have added .Dsikuli.Debug=3 as a Command Argument to my main module and all I get is ...

[LOG]PythonDebugger : overall Starting
[LOG]PythonDebugger.taskStarted : I am Starting a new Debugging Session ...
[LOG]This window is an interactive debugging context aware Python Shell
[LOG]where you can enter python console commands while debugging
>>>c:\users\rod\appdata\roaming\netbeans\7.4\config\nbpython\debug\nbpythondebug\jpydaemon.py
args =  ['C:\\Users\\rod\\AppData\\Roaming\\NetBeans\\7.4\\config\\nbPython\\debug\\nbpythondebug\\jpydaemon.py', 'localhost', '29100']
localDebuggee= None
JPyDbg connecting  localhost  on in=  29100 /out= 29101
JPyDbgI0001 : connected to  localhost
>>>log(): 1st arg can't be coerced to String['Traceback (most recent call last):
deamon ended
', '  File "C:/Users/rod/Documents/NetBeansProjects/NewPythonProject4/src/newpythonproject4.py", line 5, in <module>

    from sikuli import *
', '  File "C:\\SikuliX\\sikuli-java.jar\\Lib\\sikuli\\__init__.py", line 6, in <module>
', "TypeError: log(): 1st arg can't be coerced to String
"]
Debug session normal end

Going into the module "__init__.py"  I find

1 # Copyright 2010-2013, Sikuli.org
2 # Released under the MIT License.
3 # modified RaiMan 2013
4
5 from org.sikuli.basics import Debug
6 Debug.log(3,"Jython: sikuli: __init__: entering")
7 from Sikuli import *

I am experiencing an error on the first Debug command.  What output do you expect from using a debug command?

On Saturday, February 8, 2014 6:16 AM, RaiMan <email address hidden> wrote:

Your question #243487 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/243487

    Status: Open => Answered

RaiMan proposed the following answer:
in your project settings run section you have an entry field VM Options.
There you enter Java runtime options like -D...

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/sikuli/+question/243487/+confirm?answer_id=10

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/sikuli/+question/243487

You received this question notification because you asked the question.

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

What about running this in a normal (not debugging) session?

Might be, that there is some class name clash on sys.path with the debugging environment in netbeans.

Sikuli's class org.sikuli.basics.Debug with debug level 3 logs valuable output on the start up sequence.

Revision history for this message
Rod Caverly (rodcaverly) said :
#14

I just launch NetBeans 7.4, Java 1.7.0_51 With the debug parameters plugged in from prior tests...  Just selected to RUN not debug the script ...

# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
import org.sikuli.basics.SikuliXforJython
from sikuli import *

__author__="rod"
__date__ ="$Feb 6, 2014 2:19:05 PM$"

if __name__ == "__main__":
    print "Hello World"

The output is as follows...

[debug] SikuliXforJython: sys.path[0]: C:\Users\rod\Documents\NetBeansProjects\NewPythonProject4\src
[debug] SikuliXforJython: sys.path[1]: C:\Users\rod\AppData\Roaming\NetBeans\7.4\jython-2.5.1\Lib
[debug] SikuliXforJython: sys.path[2]: C:\Users\rod\AppData\Roaming\NetBeans\7.4\jython-2.5.1\Lib\site-packages
[debug] SikuliXforJython: sys.path[3]: C:\SikuliX\sikuli-java.jar\Lib
[debug] SikuliXforJython: sys.path[4]: C:\Users\rod\Documents\NetBeansProjects\NewPythonProject4\src
[debug] SikuliXforJython: sys.path[5]: __classpath__
[debug] SikuliXforJython: sys.path[6]: __pyclasspath__/
[debug] SikuliXforJython: found Sikuli Jython in:
/C:/SikuliX/sikuli-java.jar/Lib
[debug] SikuliXforJython: Trying to add to sys.path
[debug] SikuliXforJython: new Jython path:
[debug] SikuliXforJython: sys.path[0]: C:\Users\rod\Documents\NetBeansProjects\NewPythonProject4\src
[debug] SikuliXforJython: sys.path[1]: C:\Users\rod\AppData\Roaming\NetBeans\7.4\jython-2.5.1\Lib
[debug] SikuliXforJython: sys.path[2]: C:\Users\rod\AppData\Roaming\NetBeans\7.4\jython-2.5.1\Lib\site-packages
[debug] SikuliXforJython: sys.path[3]: C:\SikuliX\sikuli-java.jar\Lib
[debug] SikuliXforJython: sys.path[4]: C:\Users\rod\Documents\NetBeansProjects\NewPythonProject4\src
[debug] SikuliXforJython: sys.path[5]: __classpath__
[debug] SikuliXforJython: sys.path[6]: __pyclasspath__/
[debug] SikuliXforJython: sys.path[7]: /C:/SikuliX/sikuli-java.jar/Lib
[debug] ResourceLoaderBasic: SikuliX Package Build: 1.0.1 12SEP2013135849
Traceback (most recent call last):
  File "C:\Users\rod\Documents\NetBeansProjects\NewPythonProject4\src\newpythonproject4.py", line 5, in <module>
    from sikuli import *
  File "C:\SikuliX\sikuli-java.jar\Lib\sikuli\__init__.py", line 6, in <module>
TypeError: log(): 1st arg can't be coerced to String

On Monday, February 10, 2014 12:11 PM, RaiMan <email address hidden> wrote:

Your question #243487 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/243487

    Status: Open => Answered

RaiMan proposed the following answer:
What about running this in a normal (not debugging) session?

Might be, that there is some class name clash on sys.path with the
debugging environment in netbeans.

Sikuli's class org.sikuli.basics.Debug with debug level 3 logs valuable
output on the start up sequence.

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/sikuli/+question/243487/+confirm?answer_id=12

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/sikuli/+question/243487

You received this question notification because you asked the question.

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

I have no idea. what is going on.

- try without the
import org.sikuli.basics.SikuliXforJython

- download the Jython 2.7beta1 and activate/use it in Netbeans instead of the bundled 2.5.1

…???
I just made some tests on my Windows 8.1: no problems so far.

I have not tested yet with a standalone Jython though.

Revision history for this message
ashi (ashi08104) said :
#16

Hi, RaiMan, I just have the same problem on Win7 64:

I run it from command line:

c:\>java -Xmx512m -Xss1152k -Dsikuli.Debug=3 -Dpython.home="C:\jython2.5.1" -Dpython.executable="C:\jython2.5.1\bin\jython.bat" -classpath "C:\jython2.5.1\jython.jar";"c:\Program Files (x86)\sikuli\sikuli-java.jar" org.python.util.jython

and then in the jython interpreter:

Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_51
Type "help", "copyright", "credits" or "license" for more information.
>>> import org.sikuli.basics.SikuliXforJython
[debug] SikuliXforJython: sys.path[0]:
[debug] SikuliXforJython: sys.path[1]: C:\jython2.5.1\Lib
[debug] SikuliXforJython: sys.path[2]: __classpath__
[debug] SikuliXforJython: sys.path[3]: __pyclasspath__/
[debug] SikuliXforJython: sys.path[4]: C:\jython2.5.1\Lib\site-packages
[debug] SikuliXforJython: found Sikuli Jython in:
/C:/Program Files (x86)/sikuli/sikuli-java.jar/Lib
[debug] SikuliXforJython: Trying to add to sys.path
[debug] SikuliXforJython: new Jython path:
[debug] SikuliXforJython: sys.path[0]:
[debug] SikuliXforJython: sys.path[1]: C:\jython2.5.1\Lib
[debug] SikuliXforJython: sys.path[2]: __classpath__
[debug] SikuliXforJython: sys.path[3]: __pyclasspath__/
[debug] SikuliXforJython: sys.path[4]: C:\jython2.5.1\Lib\site-packages
[debug] SikuliXforJython: sys.path[5]: /C:/Program Files (x86)/sikuli/sikuli-jav
a.jar/Lib
[debug] ResourceLoaderBasic: SikuliX Package Build: 1.0.1 12SEP2013135849
>>>
>>> from sikuli import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\sikuli\sikuli-java.jar\Lib\sikuli\__init__.py", l
ine 6, in <module>
TypeError: log(): 1st arg can't be coerced to String
>>>

Thanks,
ashi

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

ok, I will look a bit deeper.

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

@ ashi:
as clearly said:
SikuliX 1.0+ should not reside in any special system folder (like program folders) due to access restrictions.

The best place is: C:\SikuliX

... but has nothing to do with this problem though ;-)

Revision history for this message
ashi (ashi08104) said :
#19

Hi, RaiMan,
Finally, I get around the problem by install jython2.7b1.

Thanks,
ashi

Revision history for this message
ashi (ashi08104) said :
#20

>@ ashi:
>as clearly said:
>SikuliX 1.0+ should not reside in any special system folder (like program folders) due to access restrictions.

>The best place is: C:\SikuliX
Thanks for the tip!

>... but has nothing to do with this problem though ;-)

I've no problem at all with the sikuli-IDE, does sikuli-IDE use jython2.5.1 or other version of jython?

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

SikuliX 1.0.1 uses 2.5.4rc1 and 1.1.0 will use 2.7beta1

… but I am just testing on my Win8.1-64 and do not have the problem with 2.7, but other problems :-(

Now I will test with 2.5.4.

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

… ok, the additional problem I have might have something to do with Win8.1 (also with 2.5.4)

Nevertheless Jython 2.5.4 as well as 2.7 do not produce the above error, so it is worth a try with Win7

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

use Jython 2.5.4 or 2.7

Revision history for this message
Rod Caverly (rodcaverly) said :
#24

Thanks RaiMan, that solved my question.

Revision history for this message
Rod Caverly (rodcaverly) said :
#25

Thank you gentlemen for the hard work...I just installed Jython 2.7Beta and did not get the error. So you stole my thunder! Seriously, I am totally impressed with the support and ultimate problem resolution.

I Love SIKULIX!

Thanks again.

Revision history for this message
Rod Caverly (rodcaverly) said :
#26

This is the source of our irritation Windows X64 or X86 produce the same result...I did download the combined Netbeans 7.4 with JDK 7u51.

http://www.oracle.com/technetwork/java/javase/downloads/jdk-7-netbeans-download-432126.html

I am downloading the testing the standalone Jython 2.7 now...

On Monday, February 10, 2014 3:12 PM, RaiMan <email address hidden> wrote:

Your question #243487 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/243487

    Status: Open => Answered

RaiMan proposed the following answer:
I have no idea. what is going on.

- try without the
import org.sikuli.basics.SikuliXforJython

- download the Jython 2.7beta1 and activate/use it in Netbeans instead
of the bundled 2.5.1

…???
I just made some tests on my Windows 8.1: no problems so far.

I have not tested yet with a standalone Jython though.

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/sikuli/+question/243487/+confirm?answer_id=14

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/sikuli/+question/243487

You received this question notification because you asked the question.