Skip to content

Commit

Permalink
fix deprecation warning in qgis.utils caused by deprecating
Browse files Browse the repository at this point in the history
imp.new_module() call in Python 3.4 (fix #32786)
  • Loading branch information
alexbruy committed Apr 21, 2020
1 parent 2bbecc0 commit 0e59d13
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/utils.py
Expand Up @@ -545,9 +545,12 @@ def reloadProjectMacros():
return

# create a new empty python module
import imp

mod = imp.new_module("proj_macros_mod")
if sys.version_info >= (3, 4):
import importlib
mod = importlib.util.module_from_spec(importlib.machinery.ModuleSpec("proj_macros_mod", None))
else:
import imp
mod = imp.new_module("proj_macros_mod")

# set the module code and store it sys.modules
exec(str(code), mod.__dict__)
Expand Down

0 comments on commit 0e59d13

Please sign in to comment.