I have a very basic flask application which imports a configuration file like so:
app.config.from_pyfile('config.py')
I'm trying to bundle this flask application using PyInstaller, which analyzes all imports to create its list of dependencies. Because config.py
isn't explicitly imported, I believe I need to add it as an additional data-file. Per this SO question I've tried the following:
pyinstaller --onefile --add-data "config.py:config.py"
When I run my bundled executable, however, I get the following error:
FileNotFoundError: [Errno 2] Unable to load configuration file (No such file or directory): 'Users/Johnny/config.py'
Everything works fine when I explicitly import the configuration file:
from config import *
But I'd rather figure out why my initial method isn't working. Note I'm running macOS 10.12.5 and python 3.4.5