Writing a python program, and I came up with this error while using the urllib.urlopen function.
Traceback (most recent call last):
File "ChurchScraper.py", line 58, in <module>
html = GetAllChurchPages()
File "ChurchScraper.py", line 48, in GetAllChurchPages
CPs = CPs + urllib.urlopen(url)
TypeError: cannot concatenate 'str' and 'instance' objects
url = 'http://website.com/index.php?cID=' + str(cID)
CPs = CPs + urllib.urlopen(url)
urlopen(url) returns a file-like object. To obtain the string contents, try
CPs = CPs + urllib.urlopen(url).read()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With