Repository: pyinstaller/pyinstaller

Issue:
cherrypy exe not running
I'm trying to run an exe created by pyinstaller for a python script that is using cherrypy. It's a very basic script (Hello World) but when I try to run the exe, I get the following error:

Traceback (most recent call last):
  File "site-packages\importlib_resources\_py3.py", line 120, in open_text
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Kudrat\\AppData\\Local\\Temp\\_MEI53322\\jaraco\\text\\Lorem ipsum.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 4, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "C:\Users\Kudrat\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\cherrypy\__init__.py", line 66, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "C:\Users\Kudrat\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\cherrypy\_cperror.py", line 135, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "C:\Users\Kudrat\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\cherrypy\lib\httputil.py", line 20, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "C:\Users\Kudrat\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\jaraco\collections.py", line 20, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "C:\Users\Kudrat\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\jaraco\text\__init__.py", line 232, in <module>
  File "site-packages\importlib_resources\_py3.py", line 158, in read_text
  File "site-packages\importlib_resources\_py3.py", line 134, in open_text
FileNotFoundError: 'Lorem ipsum.txt' resource not found in 'jaraco.text'
[6916] Failed to execute script test

I tried to google it but couldn't find anything.


Discussion:
I have the same problem. Does anyone know how to solve it?

Resolving patch:
diff --git a/PyInstaller/hooks/hook-jaraco.text.py b/PyInstaller/hooks/hook-jaraco.text.py
new file mode 100644
--- /dev/null
+++ b/PyInstaller/hooks/hook-jaraco.text.py
@@ -0,0 +1,16 @@
+#-----------------------------------------------------------------------------
+# Copyright (c) 2015-2020, PyInstaller Development Team.
+#
+# Distributed under the terms of the GNU General Public License (version 2
+# or later) with exception for distributing the bootloader.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#
+# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
+#-----------------------------------------------------------------------------
+
+# Hook for jaraco: https://pypi.python.org/pypi/jaraco.text/3.2.0
+
+from PyInstaller.utils.hooks import collect_data_files
+
+datas = collect_data_files('jaraco.text')


Test patch: