From c795106a1aacd0bc6b906bf2c9a68649b19541fc Mon Sep 17 00:00:00 2001
From: Nathan Vegdahl <cessen@cessen.com>
Date: Tue, 22 Jan 2013 18:51:08 +0000
Subject: [PATCH] Rigify: patch from Shinsuke Irie fixing rig imports on some
 systems.

From the report:
  This patch fixes a bug that rig modules of 'arm' and
  'leg' cannot be loaded failing as follows:

  Rigify: No module named 'rigify.rigs.biped.arm.biped'
  Rigify: No module named 'rigify.rigs.biped.leg.biped'

I couldn't reproduce the error, but new code works on my system
just as well as the old code, so I assume this serves to make the
code more robust on a larger range of systems.

Thanks Shinsuke!
---
 rigify/utils.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/rigify/utils.py b/rigify/utils.py
index e97fce794..bcb13a66d 100644
--- a/rigify/utils.py
+++ b/rigify/utils.py
@@ -396,7 +396,10 @@ def get_rig_type(rig_type):
     """ Fetches a rig module by name, and returns it.
     """
     #print("%s.%s.%s" % (__package__,RIG_DIR,rig_type))
-    submod = __import__(name="%s.%s.%s" % (MODULE_NAME, RIG_DIR, rig_type), fromlist=[rig_type])
+    name="%s.%s.%s" % (MODULE_NAME, RIG_DIR, rig_type)
+    submod = __import__(name)
+    for c in (name.split("."))[1:]:
+        submod = getattr(submod, c)
     imp.reload(submod)
     return submod
 
-- 
GitLab