I changed how my script was getting it’s list and somehow I broke the Gdata-API
sys.argv[1] is a text file of urls like this
The error starts when I comment out Part 1 & 2 and Add 3. When I Remove 3 and Uncomment Part 1 & 2 it works again.
Relevant code:
# PART 1 - parse bookmarks.html
#with open(sys.argv[1]) as bookmark_file:
# soup = BeautifulSoup(bookmark_file.read())
# PART 2 - extract youtube video urls
#video_url_regex = re.compile('http://www.youtube.com/watch')
#urls = [link['href'] for link in soup('a', href=video_url_regex)]
# PART 3 - parse text file
urls = open(sys.argv[1]).readlines()
Error I get now:
Traceback (most recent call last):
File "listtest.py", line 81, in <module>
comments = comments.total_results.text
AttributeError: 'NoneType' object has no attribute 'total_results'
I’d like to continue getting the Total Comments field. Thanks.
Full Code:
http://pastebin.com/1yZdEySW
EDIT: One URL in a text file is fine. When the text file is increased to two or more items then the error is reproduced.
I assigned urls to be:
(Yeah, it’s T-Pain music video)
And it worked just fine. You most likely have a problem with the file you’re opening or the parsing of the contents of that file. Or you just plain aren’t parsing it right. In any event, you’re getting comments assigned to none because you’re not passing valid ids in.