Skip to content

Commit

Permalink
wxui: support python 3.9
Browse files Browse the repository at this point in the history
I get the following exception on start:

$ 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
41, in chirpmain
    from chirp.wxui import main
File "/home/asheplyakov/work/radio/chirp/chirp/wxui/main.py", line 28,
in <module>
    import importlib_resources
ModuleNotFoundError: No module named 'importlib_resources'

$ python3 --version
Python 3.9.6

However importlib is available in Python 3.9 (as a part of
the standard library). To avoid the problem this patch removes
the version check, and checks for
importlib_resources/importlib.resources modules instead.
  • Loading branch information
asheplyakov committed Dec 29, 2022
1 parent cde101d commit a4842a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions chirp/wxui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import os
import sys

if sys.version_info < (3, 10):
try:
import importlib_resources
else:
except ModuleNotFoundError:
import importlib.resources as importlib_resources

from chirp import directory
Expand Down
4 changes: 2 additions & 2 deletions chirp/wxui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import time
import webbrowser

if sys.version_info < (3, 10):
try:
import importlib_resources
else:
except ModuleNotFoundError:
import importlib.resources as importlib_resources

import wx
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'pyserial',
'six',
'future',
'importlib-resources;python_version<"3.10"',
'importlib-resources;python_version<"3.9"',
'yattag',
],
extras_require={
Expand Down

0 comments on commit a4842a3

Please sign in to comment.