Click here to Skip to main content
15,916,280 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to get all the pictures off of /r/memes/ on reddit and store them in a folder.
when i run this code i get "line 10, in <module>
image_tags = soup.findALL('img')
TypeError: 'NoneType' object is not callable"

What I have tried:

import requests
from bs4 import BeautifulSoup as bs
import os

url = ''

page = requests.get(url)
soup = bs(page.text,'html.parser')

image_tags = soup.findALL('img')

if not os.path.exists('memes'):


x = 0

for image in image_tags:
        url = image['src']
        source = requests.get(url)
        if source.status_code == 200:
            with open('memes-' + str(x) + '.jpg', 'wb') as f:
                x += 1
Updated 8-Sep-18 4:30am

1 solution

with open('memes-' + str(x) = '.jpg', 'wb') as f:

What is that = sign doing there?
Share this answer
Member 13915301 8-Sep-18 8:42am    
i forgot to press shift, but when i run it now i get "TypeError: 'NoneType' object is not callable"
Richard MacCutchan 8-Sep-18 9:21am    
Please update the question and show where the error occurs.
Member 13915301 8-Sep-18 10:31am    
i updated it
Richard MacCutchan 8-Sep-18 10:58am    
I can only assume that the previous line soup = bs(page.text,'html.parser') failed, so the soup object has no valid reference.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900