Web Scrapping

Asked by epilefeg on 2017-03-20

Hi,

I am trying to obtain some data from a web and I want to do it with the library requests. But I am having troubles to import the modules. I am running sikuli on Mac and I tried to manually install the library with the terminal but when I try to import it its says that can't find the module.

Thanks for your help

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2017-03-22
Last query:
2017-03-22
Last reply:
2017-03-22
RaiMan (raimund-hocke) said : #1

start here:
http://sikulix.com

and use version 1.1.1

epilefeg (epilefeg) said : #2

LOL,

I just want to make sikuli go to the url and extract the data instead opening a web browser and manually copy the info. For this I need to import some library like "requests" or "url" for python. I had installed both of them but I can't make sikuli load correctly the modules.

Please help to load a externar library or module.

Thanks for your time

RaiMan (raimund-hocke) said : #3

#1 is valid in any case (prior versions will no longer be supported)

SikuliX internally uses Jython, which is Java based, understands Python language, but can only use Python modules, that are completely written in Python language (no C-based module parts).

For what you want to do, I guess you have to start with urllib or urlib2.

If you need further modules, you have to look around either for Python-language-only modules or for Java libraries, which can easily be used in Jython scripts out of the box (no Java knowledge needed).

epilefeg (epilefeg) said : #4

Thanks RaiMan for your response and patience, but I'm still having some problems, I google it the web scrapping with the urlib2 and seems very simple but I am having some problems. In most of the tutorial they use the next code:

import urllib2
pageFile = urllib2.urlopen("http://www.reddit.com")
pageHtml = pageFile.read()
pageFile.close()

But when I execute it it gave me the next error:

mar 21, 2017 6:09:55 PM org.python.netty.channel.AbstractChannel$AbstractUnsafe register
ADVERTENCIA: Force-closing a channel whose registration task was not accepted by an event loop: [id: 0xcc737db8]
java.util.concurrent.RejectedExecutionException: event executor terminated
at org.python.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:745)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:322)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:728)
at org.python.netty.channel.AbstractChannel$AbstractUnsafe.register(AbstractChannel.java:420)
at org.python.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:60)
at org.python.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:48)
at org.python.netty.channel.MultithreadEventLoopGroup.register(MultithreadEventLoopGroup.java:64)
at org.python.netty.bootstrap.AbstractBootstrap.in

itAndRegister(AbstractBootstrap.java:317)
at org.python.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:273)
at org.python.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:269)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
at org.python.core.PyObject.__call__(PyObject.java:478)
at org.python.core.PyObject.__call__(PyObject.java:482)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at _socket$py._connect$77(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py:864)
at _socket$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/

_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:153)
at org.python.core.PyFunction.__call__(PyFunction.java:423)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at _socket$py.connect$80(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py:888)
at _socket$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
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:601)
at _socket$py.meth$117(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_so

cket.py:1367)
at _socket$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
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:124)
at org.python.modules._functools.PyPartial.__call__(PyPartial.java:79)
at org.python.core.PyObject.__call__(PyObject.java:478)
at org.python.core.PyObject.__call__(PyObject.java:482)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at _socket$py.create_connection$131(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py:1507)
at _socket$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java

:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:170)
at org.python.core.PyFunction.__call__(PyFunction.java:434)
at httplib$py.connect$24(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:796)
at httplib$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:138)
at org.python.core.PyFunction.__call__(PyFunction.java:413)
at org.python.core.PyMethod.__call__(PyMethod.java:126)
at httplib$py.send$26(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:826)
at httplib$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:153)
at org.python.core.PyFunction.__call__(PyFunction.java:423)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at httplib$py._s

end_output$28(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:854)
at httplib$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:153)
at org.python.core.PyFunction.__call__(PyFunction.java:423)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at httplib$py.endheaders$31(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:997)
at httplib$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:153)
at org.python.core.PyFunction.__call__(PyFunction.java:423)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at httplib$py._send_request$34(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:1035)
at httplib$py.call_function(/Appli

cations/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
at org.python.core.PyFunction.__call__(PyFunction.java:482)
at org.python.core.PyMethod.__call__(PyMethod.java:187)
at httplib$py.request$32(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:1001)
at httplib$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
at org.python.core.PyFunction.__call__(PyFunction.java:482)
at org.python.core.PyMethod.__call__(PyMethod.java:187)
at urllib2$py.do_open$97(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:1208)
at urllib2$py.call_function(/Applications/Sikuli/SikuliX

.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:170)
at org.python.core.PyFunction.__call__(PyFunction.java:434)
at org.python.core.PyMethod.__call__(PyMethod.java:156)
at urllib2$py.http_open$101(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:1214)
at urllib2$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
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:601)
at urllib2$py._call_chain$36(/Applications/Sikuli/

SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:379)
at urllib2$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
at org.python.core.PyFunction.__call__(PyFunction.java:482)
at org.python.core.PyMethod.__call__(PyMethod.java:187)
at urllib2$py._open$38(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:426)
at urllib2$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:170)
at org.python.core.PyFunction.__call__(PyFunction.java:434)
at org.python.core.PyMethod.__call__(PyMethod.java:156)
at urllib2$py.open$37(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:412)
at urllib2$py.call_function

(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:188)
at org.python.core.PyFunction.__call__(PyFunction.java:446)
at org.python.core.PyMethod.__call__(PyMethod.java:171)
at urllib2$py.urlopen$1(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:127)
at urllib2$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:131)
at org.python.core.PyFunction.__call__(PyFunction.java:413)
at org.python.pycode._pyx926.f$0(/Applications/Sikuli/Scripts/Prueba.sikuli/Prueba.py:7)
at org.python.pycode._pyx926.call_function(/Applications/Sikuli/Scripts/Prueba.sikuli/Prueba.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyCod

e.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:208)
at org.sikuli.scriptrunner.JythonScriptRunner.runScript(JythonScriptRunner.java:176)
at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:2369)

mar 21, 2017 6:10:05 PM org.python.netty.util.concurrent.DefaultPromise execute
GRAVE: 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:745)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:322)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:728)
at org.python.netty.u

til.concurrent.DefaultPromise.execute(DefaultPromise.java:671)
at org.python.netty.util.concurrent.DefaultPromise.notifyLateListener(DefaultPromise.java:641)
at org.python.netty.util.concurrent.DefaultPromise.addListener(DefaultPromise.java:138)
at org.python.netty.channel.DefaultChannelPromise.addListener(DefaultChannelPromise.java:93)
at org.python.netty.channel.DefaultChannelPromise.addListener(DefaultChannelPromise.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
at org.python.core.PyObject.__call__(PyObject.java:478)
at org.python.core.PyObject.__call__(PyObject.java:482)
at org.python.core.PyMetho

d.__call__(PyMethod.java:141)
at _socket$py._handle_channel_future$70(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py:778)
at _socket$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
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.core.PyObject._callextra(PyObject.java:601)
at _socket$py.handle_exception$30(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py:366)
at _socket$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:161)
at org.pyth

on.core.PyFunction.__call__(PyFunction.java:434)
at org.python.core.PyMethod.__call__(PyMethod.java:156)
at _socket$py._connect$77(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py:864)
at _socket$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:153)
at org.python.core.PyFunction.__call__(PyFunction.java:423)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at _socket$py.connect$80(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py:888)
at _socket$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
at org.python.core.PyFunction.__call__(PyFunction.java:482)
at org.python.core.PyMethod.in

stancemethod___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:601)
at _socket$py.meth$117(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py:1367)
at _socket$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
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:124)
at org.python.modules._functools.PyPartial.__call__(PyPartial.java:79)
at org.python.core.PyObject.__call__(PyObject.java:478)
at org.python.core.PyObject.__call__(PyObject.java:482)
at org.python.core.PyMetho

d.__call__(PyMethod.java:141)
at _socket$py.create_connection$131(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py:1507)
at _socket$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:170)
at org.python.core.PyFunction.__call__(PyFunction.java:434)
at httplib$py.connect$24(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:796)
at httplib$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:138)
at org.python.core.PyFunction.__call__(PyFunction.java:413)
at org.python.core.PyMethod.__call__(PyMethod.java:126)
at httplib$py.send$26(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:826)
at httplib$py.call_function(/Applications/Sikuli/S

ikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:153)
at org.python.core.PyFunction.__call__(PyFunction.java:423)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at httplib$py._send_output$28(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:854)
at httplib$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:153)
at org.python.core.PyFunction.__call__(PyFunction.java:423)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at httplib$py.endheaders$31(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:997)
at httplib$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.cor

e.PyBaseCode.call(PyBaseCode.java:153)
at org.python.core.PyFunction.__call__(PyFunction.java:423)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at httplib$py._send_request$34(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:1035)
at httplib$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
at org.python.core.PyFunction.__call__(PyFunction.java:482)
at org.python.core.PyMethod.__call__(PyMethod.java:187)
at httplib$py.request$32(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py:1001)
at httplib$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/httplib.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.cal

l(PyBaseCode.java:198)
at org.python.core.PyFunction.__call__(PyFunction.java:482)
at org.python.core.PyMethod.__call__(PyMethod.java:187)
at urllib2$py.do_open$97(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:1208)
at urllib2$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:170)
at org.python.core.PyFunction.__call__(PyFunction.java:434)
at org.python.core.PyMethod.__call__(PyMethod.java:156)
at urllib2$py.http_open$101(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:1214)
at urllib2$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
at org.python.core.PyFunction.__call__(PyFunction.ja

va: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:601)
at urllib2$py._call_chain$36(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:379)
at urllib2$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
at org.python.core.PyFunction.__call__(PyFunction.java:482)
at org.python.core.PyMethod.__call__(PyMethod.java:187)
at urllib2$py._open$38(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:426)
at urllib2$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)

at org.python.core.PyBaseCode.call(PyBaseCode.java:170)
at org.python.core.PyFunction.__call__(PyFunction.java:434)
at org.python.core.PyMethod.__call__(PyMethod.java:156)
at urllib2$py.open$37(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:412)
at urllib2$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:188)
at org.python.core.PyFunction.__call__(PyFunction.java:446)
at org.python.core.PyMethod.__call__(PyMethod.java:171)
at urllib2$py.urlopen$1(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py:127)
at urllib2$py.call_function(/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:131)
at org.python.core.PyFunctio

[error] script [ Prueba ] stopped with error in line 3
[error] urllib2.URLError ( <urlopen error [Errno -1] Unmapped exception: java.util.concurrent.RejectedExecutionException: event executor terminated> )
[error] --- Traceback --- error source first
line: module ( function ) statement
1214: urllib2 ( http_open ) File "/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py", line 1184, in do_open
421: urllib2 ( _open ) File "/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py", line 382, in _call_chain
127: urllib2 ( urlopen ) File "/Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar/Lib/urllib2.py", line 404, in open
[error] --- Traceback --- end --------------

n.__call__(PyFunction.java:413)
at org.python.pycode._pyx926.f$0(/Applications/Sikuli/Scripts/Prueba.sikuli/Prueba.py:7)
at org.python.pycode._pyx926.call_function(/Applications/Sikuli/Scripts/Prueba.sikuli/Prueba.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.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:208)
at org.sikuli.scriptrunner.JythonScriptRunner.runScript(JythonScriptRunner.java:176)
at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:2369)

Thanks for your time and help,

Best RaiMan (raimund-hocke) said : #5

I made some tests with urllib2: no success - does not work as expected.

If you only need the source of a page, then this might help:

import org.sikuli.basics.FileManager as FM
page = FM.downloadURLtoString("http://sikulix.com")

tested and works.

... but reddit.com did not show up with any content.

epilefeg (epilefeg) said : #6

Thanks RaiMan, that solved my question.