1

this the error which is occurring after the code is converted to exe file

the error exception the code

Traceback (most recent call last):
  File "flask\app.py", line 2213, in _call_
  File "flask\app.py", line 2193, in wsgi_app
  File "flask\app.py", line 2190, in wsgi_app
  File "flask\app.py", line 1486, in full_dispatch_request
  File "flask\app.py", line 1484, in full_dispatch_request
  File "flask\app.py", line 1469, in dispatch_request
  File "app.py", line 122, in login
  File "flask\templating.py", line 150, in render_template
  File "jinja2\environment.py", line 1081, in get_or_select_template
  File "jinja2\environment.py", line 1010, in get_template
  File "jinja2\environment.py", line 969, in _load_template
  File "jinja2\loaders.py", line 126, in load
  File "flask\templating.py", line 64, in get_source
  File "flask\templating.py", line 98, in _get_source_fast
jinja2.exceptions.TemplateNotFound: login.html

2 Answers2

0

The error thrown here simply means that Jinja is unable to locate login.html. Ensure the templates/ folder contains the login.html file as the render_template(<path_to_file>) will look for it in the templates folder.

Note: Please do not share screenshots of code, rather snippets of code will help better.

To understand further and debug better: Flask raises TemplateNotFound error even though template file exists

0

Try using the --add-data flag to your pyinstaller command with the path to the templates folder as the argument.

For example:

pyinstaller --onefile --add-data "./templates;./templates" app.py

Use : as the path separator if you are using linux of mac.

Alexander
  • 16,091
  • 5
  • 13
  • 29