← Back to team overview

sikuli-driver team mailing list archive

[Question #674852]: [1.1.4] socket connecting only once, then Java Exception

 

New question #674852 on Sikuli:
https://answers.launchpad.net/sikuli/+question/674852

Hello all,
I'm trying to have Sikulix exchange information with a server that have to take some actions before each test, I'm using the below code (well, similar, but this one shows exactly the same problem).
For testing reasons so far the server is on my pc.
At first attempt everything runs well and on the receiving side I see "hello world From SikuliX"
When I try to run again the same script without closing the IDE I have a Java Exception, see below since it is very long.

I'm not an expert of python, so this may be a stupid problem...in case forgive me....
Thank in advance for your help

This is the code on Sikulix (has some additional and unneeded popup for debug):

import socket
result = Do.popAsk("REadyToconnect?\nclicked within 30 seconds", "testNetWork",30)
if None == result:
  print "nothing to do"
elif result:
    msg="hello world From SikuliX\n"
    data = bytearray( msg)
    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client_socket.connect(("192.168.100.1", 5050))
    client_socket.send(data)
    client_socket.close()    
    print "user said yes to\n" + msg
else:
    print "user said no"
exit()  

This is the output from Sikulix;
user said yes to
hello world From SikuliX

[info] Exit code: 0

And this is the exception I get at the second attempt:
ott 08, 2018 3:13:59 PM org.python.netty.channel.AbstractChannel$AbstractUnsafe register
WARNING: Force-closing a channel whose registration task was not accepted by an event loop: [id: 0xf7ef9343]
java.util.concurrent.RejectedExecutionException: event executor terminated
at org.python.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:821)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:327)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:320)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:746)
at org.python.netty.channel.AbstractChannel$AbstractUnsafe.register(AbstractChannel.java:475)
at org.python.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:80)
at org.python.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:74)
at org.python.netty.channel.Multit

hreadEventLoopGroup.register(MultithreadEventLoopGroup.java:86)
at org.python.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:332)
at org.python.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:283)
at org.python.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:279)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:206)
at org.python.core.PyObject.__call__(PyObject.java:497)
at org.python.core.PyObject.__call__(PyObject.java:501)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at _socket$py._connect$78(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py:911)
at _socket$py.call_fu

nction(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:154)
at org.python.core.PyFunction.__call__(PyFunction.java:423)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at _socket$py.connect$81(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py:937)
at _socket$py.call_function(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyBaseCode.call(PyBaseCode.java:199)
at org.python.core.PyFunction.__call__(PyFunction.java:482)
at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237)
at org.python.core.PyMethod.__call__(PyMethod.java:228)
at org.python.core.PyMethod.__call__(PyMethod.java:223)
at org.python.core.PyObject._callextra(PyObject.java:620)
at _socket$py.meth$119(C:/Users/ACM1COR/AppData/Roaming/Si

kulix/Lib/_socket.py:1441)
at _socket$py.call_function(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyFunction.function___call__(PyFunction.java:471)
at org.python.core.PyFunction.__call__(PyFunction.java:466)
at org.python.core.PyFunction.__call__(PyFunction.java:461)
at org.python.modules._functools.PyPartial.partial___call__(PyPartial.java:125)
at org.python.modules._functools.PyPartial.__call__(PyPartial.java:80)
at org.python.core.PyObject.__call__(PyObject.java:497)
at org.python.core.PyObject.__call__(PyObject.java:501)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at org.python.pycode._pyx601.f$0(C:/TEst/sikulix/testNetWork.sikuli/testNetWork.py:17)
at org.python.pycode._pyx601.call_function(C:/TEst/sikulix/testNetWork.sikuli/testNetWork.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.Py

Code.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at org.python.core.__builtin__.execfile_flags(__builtin__.java:535)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:286)
at org.sikuli.scriptrunner.JythonScriptRunner.runPython(JythonScriptRunner.java:205)
at org.sikuli.scriptrunner.JythonScriptRunner.runScript(JythonScriptRunner.java:174)
at org.sikuli.ide.SikuliIDE$ButtonRun$SubRun.run(SikuliIDE.java:2610)
at java.lang.Thread.run(Unknown Source)

ott 08, 2018 3:14:03 PM org.python.netty.util.concurrent.DefaultPromise safeExecute
SEVERE: Failed to submit a listener notification task. Event loop shut down?
java.util.concurrent.RejectedExecutionException: event executor terminated
at org.python.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:821)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:327)
at org.python.netty.util.concurrent.SingleThreadEventExecu

tor.addTask(SingleThreadEventExecutor.java:320)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:746)
at org.python.netty.util.concurrent.DefaultPromise.safeExecute(DefaultPromise.java:760)
at org.python.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:428)
at org.python.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:104)
at org.python.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:82)
at org.python.netty.channel.AbstractChannel$CloseFuture.setClosed(AbstractChannel.java:1058)
at org.python.netty.channel.AbstractChannel$AbstractUnsafe.register(AbstractChannel.java:486)
at org.python.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:80)
at org.python.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:74)
at org.python.netty.channel.MultithreadEventLoopGroup.register(MultithreadEventLoopGroup.java:86)
at org.python.netty.boot

strap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:332)
at org.python.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:283)
at org.python.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:279)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:206)
at org.python.core.PyObject.__call__(PyObject.java:497)
at org.python.core.PyObject.__call__(PyObject.java:501)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at _socket$py._connect$78(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py:911)
at _socket$py.call_function(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py)
at org.python.core.PyTab

leCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:154)
at org.python.core.PyFunction.__call__(PyFunction.java:423)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at _socket$py.connect$81(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py:937)
at _socket$py.call_function(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyBaseCode.call(PyBaseCode.java:199)
at org.python.core.PyFunction.__call__(PyFunction.java:482)
at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237)
at org.python.core.PyMethod.__call__(PyMethod.java:228)
at org.python.core.PyMethod.__call__(PyMethod.java:223)
at org.python.core.PyObject._callextra(PyObject.java:620)
at _socket$py.meth$119(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py:1441)
at _socket$py.call_function(C:/Users/ACM1COR/AppData/Roaming/

Sikulix/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyFunction.function___call__(PyFunction.java:471)
at org.python.core.PyFunction.__call__(PyFunction.java:466)
at org.python.core.PyFunction.__call__(PyFunction.java:461)
at org.python.modules._functools.PyPartial.partial___call__(PyPartial.java:125)
at org.python.modules._functools.PyPartial.__call__(PyPartial.java:80)
at org.python.core.PyObject.__call__(PyObject.java:497)
at org.python.core.PyObject.__call__(PyObject.java:501)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at org.python.pycode._pyx601.f$0(C:/TEst/sikulix/testNetWork.sikuli/testNetWork.py:17)
at org.python.pycode._pyx601.call_function(C:/TEst/sikulix/testNetWork.sikuli/testNetWork.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at org.python.co

re.__builtin__.execfile_flags(__builtin__.java:535)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:286)
at org.sikuli.scriptrunner.JythonScriptRunner.runPython(JythonScriptRunner.java:205)
at org.sikuli.scriptrunner.JythonScriptRunner.runScript(JythonScriptRunner.java:174)
at org.sikuli.ide.SikuliIDE$ButtonRun$SubRun.run(SikuliIDE.java:2610)
at java.lang.Thread.run(Unknown Source)

ott 08, 2018 3:14:08 PM org.python.netty.util.concurrent.DefaultPromise safeExecute
SEVERE: Failed to submit a listener notification task. Event loop shut down?
java.util.concurrent.RejectedExecutionException: event executor terminated
at org.python.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:821)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:327)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:320)
at org.python.netty.util.concurrent.Sing

leThreadEventExecutor.execute(SingleThreadEventExecutor.java:746)
at org.python.netty.util.concurrent.DefaultPromise.safeExecute(DefaultPromise.java:760)
at org.python.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:428)
at org.python.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:122)
at org.python.netty.channel.AbstractChannel$AbstractUnsafe.safeSetFailure(AbstractChannel.java:906)
at org.python.netty.channel.AbstractChannel$AbstractUnsafe.register(AbstractChannel.java:487)
at org.python.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:80)
at org.python.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:74)
at org.python.netty.channel.MultithreadEventLoopGroup.register(MultithreadEventLoopGroup.java:86)
at org.python.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:332)
at org.python.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:283)
at org.python.netty.bo

otstrap.AbstractBootstrap.bind(AbstractBootstrap.java:279)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:206)
at org.python.core.PyObject.__call__(PyObject.java:497)
at org.python.core.PyObject.__call__(PyObject.java:501)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at _socket$py._connect$78(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py:911)
at _socket$py.call_function(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:154)
at org.python.core.PyFunction.__call__(PyFunction.java:423)
at org.python.core.Py

Method.__call__(PyMethod.java:141)
at _socket$py.connect$81(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py:937)
at _socket$py.call_function(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyBaseCode.call(PyBaseCode.java:199)
at org.python.core.PyFunction.__call__(PyFunction.java:482)
at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237)
at org.python.core.PyMethod.__call__(PyMethod.java:228)
at org.python.core.PyMethod.__call__(PyMethod.java:223)
at org.python.core.PyObject._callextra(PyObject.java:620)
at _socket$py.meth$119(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py:1441)
at _socket$py.call_function(C:/Users/ACM1COR/AppData/Roaming/Sikulix/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyFunction.fun

ction___call__(PyFunction.java:471)
at org.python.core.PyFunction.__call__(PyFunction.java:466)
at org.python.core.PyFunction.__call__(PyFunction.java:461)
at org.python.modules._functools.PyPartial.partial___call__(PyPartial.java:125)
at org.python.modules._functools.PyPartial.__call__(PyPartial.java:80)
at org.python.core.PyObject.__call__(PyObject.java:497)
at org.python.core.PyObject.__call__(PyObject.java:501)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at org.python.pycode._pyx601.f$0(C:/TEst/sikulix/testNetWork.sikuli/testNetWork.py:17)
at org.python.pycode._pyx601.call_function(C:/TEst/sikulix/testNetWork.sikuli/testNetWork.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at org.python.core.__builtin__.execfile_flags(__builtin__.java:535)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:286)
at org.sikuli.scriptrunner.JythonScriptRunner.r

unPython(JythonScriptRunner.java:205)
at org.sikuli.scriptrunner.JythonScriptRunner.runScript(JythonScriptRunner.java:174)
at org.sikuli.ide.SikuliIDE$ButtonRun$SubRun.run(SikuliIDE.java:2610)
at java.lang.Thread.run(Unknown Source)

[error] script [ testNetWork ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "C:\TEst\sikulix\testNetWork.sikuli\testNetWork.py", line 10, in <module> client_socket.connect(("10.12.110.223", 5050)) File "C:\Users\ACM1COR\AppData\Roaming\Sikulix\Lib\_socket.py", line 1441, in meth return getattr(self._sock,name)(*args) File "C:\Users\ACM1COR\AppData\Roaming\Sikulix\Lib\_socket.py", line 935, in connect self._connect(addr) File "C:\Users\ACM1COR\AppData\Roaming\Sikulix\Lib\_socket.py", line 903, in _connect bind_future = bootstrap.bind(self.bind_addr).sync() at org.python.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:821)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:327)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:320)
at org.python.netty.util.concurrent.SingleThreadEven

tExecutor.execute(SingleThreadEventExecutor.java:746)
at org.python.netty.channel.AbstractChannel$AbstractUnsafe.register(AbstractChannel.java:475)
at org.python.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:80)
at org.python.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:74)
at org.python.netty.channel.MultithreadEventLoopGroup.register(MultithreadEventLoopGroup.java:86)
at org.python.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:332)
at org.python.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:283)
at org.python.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:279)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
java.util.concurrent.RejectedExecutionException: java.util.concurrent.RejectedExecutionException: event executor terminated 




-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.