From b7912f67548e0dfaa974f4e20b49b78dc137c249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carn=C3=AB=20Draug?= Date: Thu, 27 Aug 2020 16:28:38 +0100 Subject: [PATCH] EventWatcher: fix __import__ usage by replacing it with importlib (closes #1778) --- wx/lib/eventwatcher.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wx/lib/eventwatcher.py b/wx/lib/eventwatcher.py index 35772e9d..72152407 100644 --- a/wx/lib/eventwatcher.py +++ b/wx/lib/eventwatcher.py @@ -16,6 +16,8 @@ A widget and supporting classes for watching the events sent to some other widget. """ +import importlib + import wx from wx.lib.mixins.listctrl import CheckListCtrlMixin @@ -396,9 +398,7 @@ class EventWatcher(wx.Frame): if dlg.ShowModal() == wx.ID_OK: modname = dlg.GetValue() try: - # Passing a non-empty fromlist will cause __import__ to - # return the imported submodule if a dotted name is passed. - module = __import__(modname, fromlist=[0]) + module = importlib.import_module(modname) except ImportError: wx.MessageBox("Unable to import \"%s\"" % modname, "Error")