New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Files not found after packaging #5256
Files not found after packaging #5256
Comments
The missing data file issue can be fixed using from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('branca') either in your spec file (with passing the resulting But once that is sorted out, you will hit the problem with the lack of support for ENV = Environment(loader=PackageLoader('branca', 'templates')) into import sys
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
import os
from jinja2 import FileSystemLoader
bundle_dir = getattr(sys, '_MEIPASS')
data_dir = os.path.abspath(os.path.join(bundle_dir, 'branca', 'templates'))
ENV = Environment(loader=FileSystemLoader(data_dir))
else:
ENV = Environment(loader=PackageLoader('branca', 'templates')) |
Thanks a lot! that did it |
I am making a python application that uses the folium python package. The application is getting built successfully however, when I run the application I get the following error
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/Desktop/application/src/dist/main/branca/_cnames.json'
As mentioned in the official document that pysinstaller by default skips the data files I tried the solution mentioned there but did not solved the issue. I tried solving the issue using #4809, this and by using custom hooks as mentioned in #5247 but even that did not work.
I am using Python version 3.8.5 on a Ubuntu system and folium version 0.11.0
Following is a minimal example of my application
The text was updated successfully, but these errors were encountered: