Skip to content

Commit

Permalink
Update getimage.py
Browse files Browse the repository at this point in the history
try except for html file
  • Loading branch information
Snipeur060 authored Feb 11, 2024
1 parent 6b63e8a commit c0a8c7b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions train/getimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ def download_google_images(query, num_images,where):
os.makedirs(where)
print(soup)
#on save en local
with open('test.html', 'w') as f:
f.write(str(soup))

try:
with open('test.html', 'w') as f:
f.write(str(soup))
except Exception as e:
print(e)
# Télécharger les images
image_tags = soup.find_all('a', class_='rg_l')
print(image_tags)
Expand Down

0 comments on commit c0a8c7b

Please sign in to comment.