mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
handle file not found exception
This commit is contained in:
parent
becb11ea0d
commit
e5e60dd1c6
1 changed files with 5 additions and 2 deletions
|
@ -553,8 +553,11 @@ def make_image_sizes_async(file_id, thumbnail_width, medium_width, directory):
|
|||
db.session.commit()
|
||||
|
||||
# Alert regarding fascist meme content
|
||||
text = pytesseract.image_to_string(Image.open(final_place).convert('L'))
|
||||
if 'Anonymous' in text and ('No.' in text or ' N0' in text): # chan posts usually contain the text 'Anonymous' and ' No.12345'
|
||||
try:
|
||||
image_text = pytesseract.image_to_string(Image.open(final_place).convert('L'))
|
||||
except FileNotFoundError as e:
|
||||
image_text = ''
|
||||
if 'Anonymous' in image_text and ('No.' in image_text or ' N0' in image_text): # chan posts usually contain the text 'Anonymous' and ' No.12345'
|
||||
post = Post.query.filter(image_id=file.id).first()
|
||||
notification = Notification(title='Review this',
|
||||
user_id=1,
|
||||
|
|
Loading…
Add table
Reference in a new issue