> I have a problem to include the MathML schema into my schema. I've got the
> following error:
> 
>  File
> "/usr/local/lib/python2.7/dist-packages/generateDS-2.22a-py2.7.egg/EGG-INFO/scripts/generateDS.py",
> line 1228, in replace_attributeGroup_names_1
> 
> RuntimeError: maximum recursion depth exceeded in cmp
> 
> 
> If I remove the MathML, the generateDS works fine.

Bing,

OK.  generateDS.py was going into an endless/infinite recursion
while trying to replace attribute group names (in method
replace_attributeGroup_names_1).  I "fixed" it so that when it
enters that endless recursion (basically, when it calls itself with
the same attribute group name that it was called with), now it will print out
an error message and give up.

After that change (and two more small changes uncovered by your
schema), generateDS.py succeeded in generating output modules. And,
that generated module can be imported or run with no syntax errors.
But, it could be that because those attribute group names were not
successfully resolved, there are problems with that generated module.

It's also possible that this indicates a problem in the schema.
(Trying to blame the input data is a tempting software development
strategy.)  I doubt that.  But, I'll do some more checking when I
have time.

Those other two changes, by the way, both had to do with cleaning up
names that from the schema that contained periods.

I've attached a patch.  And, I've also pushed this change to
Bitbucket: https://bitbucket.org/dkuhlman/generateds

Thanks for helping me fix this (at least, I'm hoping it's a usable
fix).  If and when you have other problems, be sure to let me know.

Dave

-- 

Dave Kuhlman
http://www.davekuhlman.org
diff -r 4610927d9a2c generateDS.py
--- a/generateDS.py     Mon Apr 11 19:34:44 2016 -0700
+++ b/generateDS.py     Wed Apr 20 16:52:33 2016 -0700
@@ -202,7 +202,7 @@
 # Do not modify the following VERSION comments.
 # Used by updateversion.py.
 ##VERSION##
-VERSION = '2.22a'
+VERSION = '2.22b'
 ##VERSION##
 
 if sys.version_info.major == 2:
@@ -1235,6 +1235,11 @@
         if key is not None:
             attrGroup = AttributeGroups[key]
             for name in attrGroup.getKeys():
+                if name == groupName:
+                    err_msg('*** Error.  Element {} attributeGroup {} '
+                            'has endless recursion\n'.format(
+                                self.getName(), groupName))
+                    return
                 if (name in AttributeGroups or
                         strip_namespace(name) in AttributeGroups):
                     self.replace_attributeGroup_names_1(name)
@@ -1243,8 +1248,9 @@
                     self.attributeDefs[name] = attr
                     self.attributeDefsList.append(name)
         else:
-            err_msg('*** Error. attributeGroup %s not defined.\n' % (
-                groupName, ))
+            err_msg('*** Error. Element %s attributeGroup %s '
+                    'not defined.\n' % (
+                        self.getName(), groupName, ))
 
     def __str__(self):
         s1 = '<XschemaElement name: "%s" type: "%s">' % \
@@ -3748,6 +3754,7 @@
                 name = mapName(name)
             else:
                 name = mappedName
+            name = cleanupName(name)
             s1 = "            self.%s.append(obj_)\n" % (name, )
         else:
             substitutionGroup = child.getAttrs().get('substitutionGroup')
@@ -3756,6 +3763,7 @@
                 name = mapName(name)
             else:
                 name = mapName(headName)
+            name = cleanupName(name)
             s1 = "            self.%s = obj_\n" % (name, )
         wrt(s1)
         wrt("            obj_.original_tagname_ = '%s'\n" % (origName, ))
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to