RaiMan / SikuliX-2014

SikuliX version 1.1.2 (until February 2018)
http://sikulix.com
806 stars 234 forks source link

Problem wit urlllib.urlopen #241

Closed Vadiml1024 closed 7 years ago

Vadiml1024 commented 7 years ago

Hello,

I'm running following code in IDE:

import httplib import sys
from HTMLParser import HTMLParser
import urllib
import json

def fetchtrends():
    return urllib.urlopen("http://tsw.forexprostools.com/index.php?timeframe=60&forex=1,2").read()

fetchtrends()

Un the first run it works ok On the second run it generates exception.

Any ideas how to fix the issue:

The exception in question:

Dec 18, 2016 8:34:08 PM org.python.netty.channel.AbstractChannel$AbstractUnsafe register WARNING: Force-closing a channel whose registration task was not accepted by an event loop: [id: 0xccf6a191] java.util.concurrent.RejectedExecutionException: event executor terminated at ....... more .... [error] script [ GetTrends ] stopped with error in line 13 [error] IOError ( [Errno socket error] error(-1, u'Unmapped exception: java.util.concurrent.RejectedExecutionException: event executor terminated') ) [error] --- Traceback --- error source first line: module ( function ) statement 792: httplib ( connect ) File "/home/vadim/Sikuli/sikulix.jar/Lib/_socket.py", line 1505, in create_connection 850: httplib ( _send_output ) File "/home/vadim/Sikuli/sikulix.jar/Lib/httplib.py", line 812, in send 344: urllib ( open_http ) File "/home/vadim/Sikuli/sikulix.jar/Lib/httplib.py", line 997, in endheaders 86: urllib ( urlopen ) File "/home/vadim/Sikuli/sikulix.jar/Lib/urllib.py", line 207, in open 9: main ( fetchtrends ) return urllib.urlopen("http://tsw.forexprostools.com/index.php?timeframe=60&forex=1,2").read() [error] --- Traceback --- end --------------

RaiMan commented 7 years ago

Has nothing to do with SikuliX.

A usage problem of urllib or a bug, that might be caused by the fact, that the interpreter session is not closed at script run end and that we use Jython based on Java.

Run your script from commandline, so you get a clean environment at each run.

... or look for the error situation in forums like stackoverflow (urllib jython)