My Python script, application.py, uses weight_res1.h5 files located in the same directory as application.py and throwing this errorAnd presumably your Python code references this file using something like
filename = "weight_res1.h5"
which assumes that weight_res1.h5 is in your current working directory instead of
import os
filename = os.path.join(os.path.dirname(__file__), "weight_res1.h5")
which assumes that weight_res1.h5 is next to you application.py? In which case your code is broken even without PyInstaller if you don’t set your working directory to the directory containing your code . There’s a bit more on the topic here.