Urllib2 HTTP 404
Olivia Zamora
urllib2.HTTPError: HTTP Error 404: Not Found is being returned when i try to execute my Python 2.7 script the full traceback is located at how do i fix this?
site = ""
file_path = site + "/
error-typeerror-unsupported-operand-types-for-instance-and/1156049#1156049"
import urllib2
server = urllib2.urlopen(site)
response = urllib2.urlopen(file_path)
print(response.read())Edit: The problem is solved now i copied the full URL when I needed Urllib2 HTTP 404
site = ""
file_path = ""
import urllib2
server = urllib2.urlopen(site)
response = urllib2.urlopen(file_path)
print(response.read()) 1 Answer
Your URL is incorrect, of course.
That's what a 404 error usually means: Such a file or location does not exist.
In this case, the mistake is obvious: Your "file_path" string is "
error-typeerror-unsupported-operand-types-for-instance-and/1156049#1156049" and that's clearly not valid. Try it in a web browser and you will see.