Flask "Error: The file/path provided does not appear to exist" although the file does exist

PDiracDelta picture PDiracDelta · Jan 28, 2017 · Viewed 22.4k times · Source

I use export FLASK_APP=flask_app and then do flask run but I get the error:

Error: The file/path provided (flask_app) does not appear to exist. Please verify the path is correct. If app is not on PYTHONPATH, ensure the extension is .py

However, the file does exist and is even in the present working directory. Using the complete path to the file does not work either.

Answer

PDiracDelta picture PDiracDelta · Jan 28, 2017

This situation occurs when you have an ImportError which is not propagated through to your terminal. Check all of your files for invalid import statements, fix them, and the error should disappear.

EDIT 2017-04-02: @Michael pointed out that my reference now placed under the tag "OLD MESSAGE PART 2" is incorrect. I don't know how this mistake came to be, but I've found a very recent post on the Flask Github where they reference the commit that should have fixed the issue on Dec 30th of 2016. Probably at that time I was indeed running an older flask version.

OLD MESSAGE PART 2: This issue is discussed on the Flask Github, though I am unsure as to when and even whether it has actually been fixed, since I still encounter the error today even though I downloaded Flask after the merge of the fix described on that page (12 Aug 2016).