Skip to content

Commit

Permalink
Fixed startup error (app icon and stock configs can't be found)
Browse files Browse the repository at this point in the history
I get the following error on startup:

$ python3 chirpwx.py

Traceback (most recent call last):
  File "/home/asheplyakov/work/radio/chirp/chirpwx.py", line 8, in <module>
    sys.exit(chirpmain())
  File "/home/asheplyakov/work/radio/chirp/chirp/wxui/__init__.py", line 94, in chirpmain
    mainwindow = main.ChirpMain(None, title='CHIRP')
  File "/home/asheplyakov/work/radio/chirp/chirp/wxui/main.py", line 307, in __init__
    self.set_icon()
  File "/home/asheplyakov/work/radio/chirp/chirp/wxui/main.py", line 342, in set_icon
    importlib_resources.files('chirp.share')
  File "/usr/lib64/python3.9/importlib/resources.py", line 147, in files
    return _common.from_package(_get_package(package))
  File "/usr/lib64/python3.9/importlib/_common.py", line 14, in from_package
    return fallback_resources(package.__spec__)
  File "/usr/lib64/python3.9/importlib/_common.py", line 18, in fallback_resources
    package_directory = pathlib.Path(spec.origin).parent
  File "/usr/lib64/python3.9/pathlib.py", line 1072, in __new__
    self = cls._from_parts(args, init=False)
  File "/usr/lib64/python3.9/pathlib.py", line 697, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/usr/lib64/python3.9/pathlib.py", line 681, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

The problem is that 'chirp.share' is not a proper python package,
therefore importlib fails to locate its resources.
To avoid the problem this patch adds empty __init__.py files to
chirp/share and chirp/stock_configs directories.

As a side effect setup.py installs (the content of) these directories
(which makes packagers more happy).
  • Loading branch information
asheplyakov committed Dec 29, 2022
1 parent a4842a3 commit 21a74cd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 0 deletions.
Empty file added chirp/share/__init__.py
Empty file.
Empty file added chirp/stock_configs/__init__.py
Empty file.

0 comments on commit 21a74cd

Please sign in to comment.