I am on Windows 8, installed Anaconda Python 2.7.11. here's my python code:
import urllib2
url = "http://real-chart.finance.yahoo.com/table.csv?s=GOOG&ignore=.csv"
response = urllib2.urlopen(url)
data = response.read()
read = csv.DictReader(data)
I just found this code somewhere else and copied it (and replaced it with my own url).
And I am getting this error trace:
Traceback (most recent call last):
File "01_get_traindata.py", line 25, in <module>
response = urllib2.urlopen(url)
File "C:\Users\Tin Tran\Anaconda2\lib\urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Tin Tran\Anaconda2\lib\urllib2.py", line 431, in open
response = self._open(req, data)
File "C:\Users\Tin Tran\Anaconda2\lib\urllib2.py", line 449, in _open
'_open', req)
File "C:\Users\Tin Tran\Anaconda2\lib\urllib2.py", line 409, in _call_chain
result = func(*args)
File "C:\Users\Tin Tran\Anaconda2\lib\urllib2.py", line 1227, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Users\Tin Tran\Anaconda2\lib\urllib2.py", line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 10013] An attempt was made to access a s
ocket in a way forbidden by its access permissions>
I read somewhere else that it might have to do something firewall so I have disabled my firewall and it's still happening.
Things i have tried: setting the python.exe to run as administrator (I got "Access denied." in command window after being prompted to run as administrator) already allowed python.exe in my firewall (still doesn't work). Even turned off firewall completely (still doesn't work). I checked and my account is already admin as well.
UPDATE: solved after i restarted computer. I do still have my firewall turned off and allow python.exe through my firewall. Maybe a restart was needed. Strange.