[Bf-blender-cvs] [1496105327f] temp-usd-merge-master: USD IO: handle UMM Python module load error.

Michael Kowalski noreply at git.blender.org
Mon Oct 25 15:35:58 CEST 2021


Commit: 1496105327f232635a815c1e9d3ded4a59dbe0d4
Author: Michael Kowalski
Date:   Sun Oct 24 13:51:20 2021 -0400
Branches: temp-usd-merge-master
https://developer.blender.org/rB1496105327f232635a815c1e9d3ded4a59dbe0d4

USD IO: handle UMM Python module load error.

Clearing the Python import module error if loading
the UMM module failed.  If we don't do this, the
Python unit test for USD will fail if the UMM
addon isn't installed. Also printing the Python
error in this case, if printing warnings is enabled.

===================================================================

M	source/blender/io/usd/intern/usd_umm.cc

===================================================================

diff --git a/source/blender/io/usd/intern/usd_umm.cc b/source/blender/io/usd/intern/usd_umm.cc
index 0793dad23ea..c417a06da24 100644
--- a/source/blender/io/usd/intern/usd_umm.cc
+++ b/source/blender/io/usd/intern/usd_umm.cc
@@ -334,8 +334,14 @@ static bool ensure_module_loaded(bool warn = true)
 
   if (!g_umm_module) {
     g_umm_module = PyImport_ImportModule(k_umm_module_name);
-    if (warn && !g_umm_module) {
-      std::cout << "WARNING: couldn't load Python module " << k_umm_module_name << std::endl;
+    if (!g_umm_module) {
+      if (warn) {
+        std::cout << "WARNING: couldn't load Python module " << k_umm_module_name << std::endl;
+        if (PyErr_Occurred()) {
+          PyErr_Print();
+        }
+      }
+      PyErr_Clear();
     }
   }



More information about the Bf-blender-cvs mailing list