Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

mp_util.py: work around imp module going away in 3.12 #1299

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions MAVProxy/modules/lib/mp_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,22 @@
# auto-detection is failing on windows, for an unknown reason
has_wxpython = True
else:
import imp
try:
imp.find_module('wx')
has_wxpython = True
except ImportError as e:
pass
import importlib
try:
import importlib.util
except ImportError:
pass

if importlib.util.find_spec('wx') is not None:
has_wxpython = True
except (ImportError, ModuleNotFoundError):
import imp
try:
imp.find_module('wx')
has_wxpython = True
except ImportError as e:
pass

radius_of_earth = 6378100.0 # in meters

Expand Down