Jul-07-2020, 12:56 PM
(Jul-07-2020, 12:47 PM)DeaD_EyE Wrote: You could use this module form the standard lib: https://docs.python.org/2/library/imghdr.html
Thank you but it looks that I already need to know the extension in this way, I know the file name but not the extension, then I cannot use it.
I'm also trying to create if, in this way:
{% set path = '/static/images/images/' + recipe._id|string + '.png' %} {% if (os.path.isfile(path)) %} <p>File EXISTS</p> {% else %} <p>File DO NOT EXISTS</p> {% endif %}But I keep receiving the following error:
jinja2.exceptions.UndefinedError
jinja2.exceptions.UndefinedError: 'os' is undefined
os is defined in the main.py file, maybe I must use a different syntax, but I'm a beginner, I have no idea how it needs to be done.