From: Stuart Prescott <stuart@debian.org>
Date: Tue, 4 Feb 2025 20:58:09 +1100
Subject: Don't fail when pyc files in /usr/lib can't be removed

sasview tries to open local_config.py using load_module_from_path() but
local_config.py(c) will be in a read-only location in /usr/lib so this
fails.
---
 sasmodels/custom/__init__.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sasmodels/custom/__init__.py b/sasmodels/custom/__init__.py
index e04e4b8..1f6542c 100644
--- a/sasmodels/custom/__init__.py
+++ b/sasmodels/custom/__init__.py
@@ -43,7 +43,10 @@ except ImportError:
             del sys.modules[fullname]
         if path.endswith(".py") and os.path.exists(path) and os.path.exists(path+"c"):
             # remove automatic pyc file before loading a py file
-            os.unlink(path+"c")
+            try:
+                os.unlink(path+"c")
+            except:
+                pass
         module = imp.load_source(fullname, os.path.expanduser(path))
         return module
 
