> From: Amal Khailtash > Sent: Wed, August 4, 2010 3:27:47 PM > > Hello, > > I ran your tool against the following schemas: > > http://www.spiritconsortium.org/XMLSchema/SPIRIT/1.5 > > All the top-level schemas (abstractionDefinition.xsd, > abstractor.xsd, busDefinition.xsd, busInterface.xsd, > component.xsd, design.xsd, generator.xsd) seem to work properly, > but the top-most one (index.xsd) does not behave well. > > If I use an xml input to a test program that uses the > abstractDefinition parse method, it works fine. But if I use the > classes generated by using index.xsd that is the top-most schema, > and use the same xml input (for abstractDefinition): > > This one works (test.py): > > > import sys > import abstractionDefinition > rootObject = abstractionDefinition.parse('clock_rtl.xml') > > > This one gives me an error (main.py) > import sys > import IP_XACT_Document > rootObject = IP_XACT_Document.parse('clock_rtl.xml') > > > I get the following error: > > <?xml version="1.0" ?> > Traceback (most recent call last): > File "./main.py", line 6, in <module> > rootObject = IP_XACT_Document.parse('clock_rtl.xml') > File > "/home/amal/Downloads/labels/IP-XACT-1.5-Handoff-to-IEEE/IP_XACT_Document.py", > line 21867, in parse > namespacedef_='') > File > "/home/amal/Downloads/labels/IP-XACT-1.5-Handoff-to-IEEE/IP_XACT_Document.py", > line 20577, in export > showIndent(outfile, level) > File > "/home/amal/Downloads/labels/IP-XACT-1.5-Handoff-to-IEEE/IP_XACT_Document.py", > line 115, in showIndent > for idx in range(level): > TypeError: 'range' object is not iterable >
Amal - I downloaded the schemas from http://www.spiritconsortium.org/XMLSchema/SPIRIT/1.5. There are elements defined in those .xsd files that are named "range". So, generateDS.py is generating a class named "range". This overrides and hides the built-in function "range". Therefore, I suggest that you map the name "range" to different name. In order to do so, you can add a line something like the following to the global dictionary NameTable in generateDS.py: 'range': 'range_', It will end up looking something like this: NameTable = { 'type': 'type_', 'float': 'float_', 'build': 'build_', 'range': 'range_', } See the following for a bit of information about this: http://www.rexx.com/~dkuhlman/generateDS.html#conflicts-with-python-keywords I suppose there should be some way to add to this mapping table without modifying generateDS.py itself. I'll have to think about that. Please let me know if the above change fixes this problem for you. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm _______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users