I have following project structure:
package1/
__init__.py
some.py
package2
__init__.py
some.py
static_data/
__init__.py
file1.txt
file2.txt
...
my_script.py
my_script.py
contains imports from all over the structure. And python code wotks fine except of importlib_resources
usage.
I access files with importlib_resources
(Python 3.6) like so: importlib_resources.open_text(static_data, 'file1.txt').readlines()
Building executable with: pyinstaller my_script.py -F --noconsole --noupx
In result executable I get following error:
File "lib\site-packages\importlib_resources\_py3.py", line 62, in open_text
File "lib\site-packages\importlib_resources\_py3.py", line 52, in open_binary
FileNotFoundError: 'file1.txt' resource not found in 'package1.package2.static_data'
What is the correct way to include resources used with importlib_resources
?
from Pyinstaller: How to include resources from package used by importlib_resources
No comments:
Post a Comment