Eu tenho o python 2.7 instalado e estou enfrentando erros ao tentar executar scripts em Python. O Ground Control do aplicativo Launchpad baseado em GUI não pode ser iniciado e está enfrentando bugs.
Mas mesmo um programa simples não pode ser executado:
from urllib import urlencode
from urllib2 import urlopen
pg = urlopen("http://www.beans-r-us.biz/proces.html")
text = pg.read().decode("utf8")
where = text.find(">$")
start_of_price = where + 2
end_og_price = start_og_price + 4
price = float(text[start_of_price:end_of_price])
print "The current price of coffee is:", price
O log de erros é o seguinte:
Traceback (most recent call last):
File "androidscript.py", line 4, in <module>
pg = urlopen("http://www.beans-r-us.biz/proces.html")
File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 400, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 513, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 432, in error
result = self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 372, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 619, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/lib/python2.7/urllib2.py", line 400, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 513, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 438, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 372, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 521, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
anant@anant-Inspiron-N5010:~/Documents$
Alguém, por favor, me ajude com isso.