[2.0.5] IDE: second scriptrun in same session: urllib.urlopen() crashes --- workaround

Asked by sergio

-------------------- workaround
add the following snippet to your script, so that it is run before any usage of urllib

import _socket
if _socket.NIO_GROUP.isShutdown():
    _socket.NIO_GROUP = _socket.NioEventLoopGroup(2, _socket.DaemonThreadFactory("PyScan-Netty-Client-%s"))
    sys.registerCloser(_socket._shutdown_threadpool)

The workaround is taken from
https://docs.roguewave.com/en/klocwork/2018/javautilconcurrentrejectedexecutionexception

Thanks @ Chetan (comment #1)
-------------------------------------------------------------------------------------------------

Hi!
I have a problem with SIKULIX IDE 2.0.5.
Im trying to make a get request to a webservice. I've already tried the urllib and urllib2 python libs to accomplish this and the IDE is returning me this error:

[error] java.util.concurrent.RejectedExecutionException ( java.util.concurrent.RejectedExecutionException: event executor terminated )

I dont know what to do, should i try a java lib instead?

heres a example code to accomplish this:

import urllib

f = urllib.urlopen("http://www.testapi.com")
print(f.read())

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
sergio
Solved:
Last query:
Last reply:
Revision history for this message
Chetan (cshamdas) said (last edit ):
#1

i am also able to repro this. on searching net looks related to jython and not IDE. will elt raiman confirm this
known issue details
https://docs.roguewave.com/en/klocwork/2018/javautilconcurrentrejectedexecutionexception

Revision history for this message
Chetan (cshamdas) said :
#2
Revision history for this message
sergio (sserdev) said :
#3

Thanks man! it solved my issue!