← Back to team overview

sikuli-driver team mailing list archive

[Bug 1464105] Re: [1.1.0] Jython 2.7: urllib.FancyURLopener only works the first time after import urllib --- Jython problem --- workaround

 

Same here. It worked in Windows 7, then I tried Linux Mint but got the
error above. First thought it could be a Windows/Linux incompatibility
issue but after checking it turned out that i had Sikuli 1.0.1 on the
Windows PC and 1.1.0 on Linux Mint PC. Seems as repeating
urllib2.urlopen() when the Sikuli script is running works OK in 1.1.0,
it's when you rerun the script without restarting Sikuli IDE the error
appears. The bug is a bit annoying so i added a check if it is a rerun
in the beginning of the script and if it is popup a message saying the
IDE has to be restarted.

try:
  if rerun:    
     popup("urllib2.urlopen() will not work when repeating Run in Sikuli IDE so close IDE before rerun")
except:
  rerun = True

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1464105

Title:
  [1.1.0] Jython 2.7: urllib.FancyURLopener only works the first time
  after import urllib --- Jython problem --- workaround

Status in Sikuli:
  Confirmed

Bug description:
  ************ workaround

  run script from command line after having edited and saved it in IDE

  ------------------------------------------

  I use SikliX 1.1.0
  Code like this:

  import urllib
  opener = urllib.FancyURLopener({})
  f = opener.open("http://www.python.org/";)
  print f.read()

  六月 11, 2015 11:29:24 上午 org.python.netty.channel.AbstractChannel$AbstractUnsafe register
  警告: Force-closing a channel whose registration task was not accepted by an event loop: [id: 0x1d496cfb]
  java.util.concurrent.RejectedExecutionException: event executor terminated
  at org.python.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:745)
  ...
  at _socket$py.connect$80(E:\sikuli\sikulix.jar\Lib\_socket.py:888)
  at _socket$py.call_function(E:\sikuli\sikulix.jar\Lib\_socket.py)
  ...
  at httplib$py._send_output$28(E:\sikuli\sikulix.jar\Lib\httplib.py:854)
  at httplib$py.call_function(E:\sikuli\sikulix.jar\Lib\httplib.py)
  ...
  at urllib$py.open$14(E:\sikuli\sikulix.jar\Lib\urllib.py:211)
  at urllib$py.call_function(E:\sikuli\sikulix.jar\Lib\urllib.py)
  ...
  at org.python.pycode._pyx1226.f$0(E:\sikuli\workspace\testpost.sikuli\testpost.py:4)
  at org.python.pycode._pyx1226.call_function(E:\sikuli\workspace\testpost.sikuli\testpost.py)
  ...
  [error] script [ testpost ] stopped with error in line 3
  [error] IOError ( [Errno socket error] error(-1, u'Unmapped exception: java.util.concurrent.RejectedExecutionException: event executor terminated') )

  .core.PyCode.call(PyCode.java:18)
  at org.python.core.Py.runCode(Py.java:1386)
  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:209)
  at org.sikuli.scriptrunner.JythonScriptRunner.runScript(JythonScriptRunner.java:177)
  at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:2369)

  I guess this may connect with Jython.

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1464105/+subscriptions


References