def resource_path(relative_path):
    """ Get absolute path to resource, works for dev and for PyInstaller """
try:
    base_path = sys._MEIPASS
except Exception:
    base_path = os.path.abspath('.')
return os.path.join(base_path, relative_path)
Bundling data files with PyInstaller (--onefile)