socket error ([Erno 32] Socket closed)
Hi!
I am a brand new user of sikuli (and almost a noob at coding) and I'm using it for an Interaction Design project.
Recently I had an error while trying to connect to the internet to parse some html via the Sikuli IDE (I'm using the latest version of Sikulix, MAC, Yosemite 10.10.1 and I use LittleSnitch, but turn it off for testing purpose).
When I run my sript I get this error:
[error] script [ fiznik ] stopped with error in line 29
[error] socket.error ( [Errno 32] Socket closed )
[error] --- Traceback --- error source first
line: module ( function ) statement
174: socket ( handle_exception ) socket.error: [Errno 32] Socket closed
585: httplib ( _read_chunked ) File "/Users/
1651: socket ( read ) File "/Users/
[error] --- Traceback --- end --------------
and this is the code
from HTMLParser import HTMLParser
import urllib2
ignoredLinks = ["[","]"," N "]
linklist = []
class MyHTMLParser(
def __init__(self):
HTMLParser.
self.currentLink = None
self.inParagraph = False
def handle_
if(tag=='p'): self.inParagraph = True
elif(
self.currentLink = ""
def handle_endtag(self, tag):
if(tag=='p'): self.inParagraph = False
elif(tag=="a" and self.currentLin
if not any(match in self.currentLink for match in ignoredLinks):
linklist.
self.
def handle_data(self, data):
if self.currentLin
req = urllib2.urlopen("https:/
html = req.read()
html = unicode(html, req.headers[
parser = MyHTMLParser()
parser.feed(html)
i = 0
for link in linklist:
i+=1
print i,":",link
The error seems to happen at html = req.read()
When I run it in a .py file using terminal it works perfectly and retrieves all I need but as you see when I run it from sikulix, something seems to interrupt the process...
Does anyone have an answer? It would be awesome, as my project is the first step for my Bachelor thesis!
PXP
Question information
- Language:
- English Edit question
- Status:
- Expired
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: