question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FileNotFoundError grapheme_break_property.json when built as executable with PyInstaller

See original GitHub issue

Hello, I am shipping executables with PyInstaller. Even though I’ve enabled hidden import for alive-progress/alive_progress, The executable throws the following error during runtime.

  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "alive_progress/styles/exhibit.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "alive_progress/styles/internal.py", line 144, in <module>
  File "alive_progress/styles/internal.py", line 22, in __create_spinners
  File "alive_progress/animations/spinners.py", line 43, in frame_spinner_factory
  File "alive_progress/animations/spinners.py", line 43, in <genexpr>
  File "alive_progress/animations/spinners.py", line 43, in <genexpr>
  File "alive_progress/utils/cells.py", line 144, in to_cells
  File "alive_progress/utils/cells.py", line 148, in split_graphemes
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "grapheme/__init__.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "grapheme/api.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "grapheme/finder.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "grapheme/grapheme_property_group.py", line 97, in <module>
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEIr3FD7j/grapheme/data/grapheme_break_property.json'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
xinxin8816commented, Jul 24, 2022

CLI Just add grapheme data like pyinstaller -F "Hello World.py" --collect-all grapheme

6reactions
controladocommented, Mar 13, 2022

U have to run this pyi-makespec --onefile start.py in terminal with ur main.py file. After that, put that line in the spec file after a block code:

a.datas += Tree("<python_path>/Lib/site-packages/grapheme/", prefix= "grapheme") a.datas += Tree("<python_path>/lib/site-packages/about-time/", prefix= "about-time")

Like that:

a = Analysis(['script.py'],
             pathex=[],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
a.datas += Tree("<python_path>/Lib/site-packages/grapheme/", prefix= "grapheme")
a.datas += Tree("<python_path>/lib/site-packages/about-time/", prefix= "about-time")

Then, run pyinstaller spec file and that’s it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

python PyInstaller created executable failed to run the exe Error
json "resources" is the package where from you have to take the data file. Now run the following in command window from your...
Read more >
using pyinstaller when importing pygsheets #490 - GitHub
I'm trying to create an exe file to distribute among users in my company. ... Key (json file) to the 'dist' folder created...
Read more >
Python exe cannot find "default-schema.json"
Hi Everyone, I have been trying to package a script in dash using pyinstaller. The dash app is supposed to plot a plotly...
Read more >
Bokeh 2.0.0 and PyInstaller - Community Support
I am unable to successfully create a pyinstaller executable with bokeh==2.0.0, I get the following error: FileNotFoundError: [Errno 2] No ...
Read more >
how to include json in executable file by pyinstaller - splunktool
Use the spec file that is made when you first run pyinstaller on a py script. From there you can add json and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found