TypeError: expected string or bytes-like object, got 'NoneType'

52 views
Skip to first unread message

Arul Suresh

unread,
Jul 18, 2024, 1:49:25 AM7/18/24
to PyInstaller
I'm trying to build a utility app, using the following installed packages:

python = ">=3.11, <3.13"
numpy = ">=1.24.3"
scipy = ">=1.13.1"
pyqt5 = "=5.15.10"
pyqt5-qt5 = "=5.15.2"
markdown = "^3.6"

The application runs exactly as I expect when I run it as a python script while developing it. pyinstaller has been working for a while, and suddenly this evening throws a 'got a NoneType' type error. Here's the console output:

pyinstaller .\tolstack\main.py
375 INFO: PyInstaller: 6.9.0, contrib hooks: 2024.7
375 INFO: Python: 3.12.4
413 INFO: Platform: Windows-11-10.0.22631-SP0
414 INFO: Python environment: K:\git\tolstack\.venv

[ TRIMMED NORMAL-LOOKING OUTPUT HERE]

22356 INFO: Loading module hook 'hook-jaraco.text.py' from 'K:\\git\\tolstack\\.venv\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
22552 INFO: Loading module hook 'hook-importlib_resources.py' from 'K:\\git\\tolstack\\.venv\\Lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "K:\git\tolstack\.venv\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "K:\git\tolstack\.venv\Lib\site-packages\PyInstaller\__main__.py", line 231, in _console_script_run
    run()
  File "K:\git\tolstack\.venv\Lib\site-packages\PyInstaller\__main__.py", line 215, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "K:\git\tolstack\.venv\Lib\site-packages\PyInstaller\__main__.py", line 70, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "K:\git\tolstack\.venv\Lib\site-packages\PyInstaller\building\build_main.py", line 1216, in main
    build(specfile, distpath, workpath, clean_build)
  File "K:\git\tolstack\.venv\Lib\site-packages\PyInstaller\building\build_main.py", line 

[ TRIMMED A LOT OF TRACEBACK HERE ]

File "K:\git\tolstack\.venv\Lib\site-packages\PyInstaller\compat.py", line 583, in importlib_load_source
    mod_loader.exec_module(mod)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "K:\git\tolstack\.venv\Lib\site-packages\PyInstaller\hooks\hook-importlib_resources.py", line 18, in <module>
    if check_requirement("importlib_resources < 1.2.0"):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "K:\git\tolstack\.venv\Lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 414, in check_requirement
    return parsed_requirement.specifier.contains(version, prereleases=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "K:\git\tolstack\.venv\Lib\site-packages\packaging\specifiers.py", line 906, in contains
    item = Version(item)
           ^^^^^^^^^^^^^
  File "K:\git\tolstack\.venv\Lib\site-packages\packaging\version.py", line 200, in __init__
    match = self._regex.search(version)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

Any ideas on what I could have broken? I've tried:
  • pyinstaller versions 6.7.0, 6.8.0, and 6.9.0
  • restarting vscode and the computer
  • Reverting to an earlier commit just in case my application code somehow broke something.
The location of the error seems to suggest it's some sort of error in a pyinstaller hook that I didn't write, but I'm not sure how I suddenly changed my dev environment.

Any ideas would be great!
Reply all
Reply to author
Forward
0 new messages