Here's the problem:
When you're trying to do
f.write(blog +' '+ authority +'\n')
Python is throwing a ValueError
because you can't add an int
and a str
. You're also catching every exception which is ill-advised. Change the offending line to convert authority
to a str
:
f.write(blog +' '+ authority +'\n')
And you should be okay. Get rid of the blanket except
clause and only catch specific exceptions that you want to catch. While you're developing this code, I would recommend you don't catch any any exceptions just so you can tell why things are going wrong.