← 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

 

I had similar problem with urllib/urllib2, script worked in sikuli 1.0.1 but in 1.1.0 not 
Finally I made connection through java, since jython could import java modules

from java.net import URL
def callURL(self, url): URL(url).openConnection().getInputStream()

-- 
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