From 22c6304a53b4515b7cb51a12b56bea2568713692 Mon Sep 17 00:00:00 2001 From: Michael Curran Date: Wed, 26 Jun 2019 13:57:08 +1000 Subject: [PATCH] config.addConfigDirsToPythonPackagePath: When adding scratchpad dirs, create them if they don't already exist. --- source/config/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/config/__init__.py b/source/config/__init__.py index 034c95facba..5b3dd533150 100644 --- a/source/config/__init__.py +++ b/source/config/__init__.py @@ -338,6 +338,9 @@ def addConfigDirsToPythonPackagePath(module, subdir=None): if not subdir: subdir = module.__name__ fullPath=os.path.join(getScratchpadDir(),subdir) + # Ensure this directory exists otherwise pkgutil.iter_importers may emit None for missing paths. + if not os.path.isdir(fullPath): + os.makedirs(fullPath) # Insert this path at the beginning of the module's search paths. # The module's search paths may not be a mutable list, so replace it with a new one pathList=[fullPath]