Rohan,

That looks like a bug.  After a quick search, I found that this
error occurred in the parseString function in the generated subclass
modules (that is, the modules generated with the -s command line
option).  Is that where you found it?

I've attached a patch.  If the patch does not apply correctly, you
can find the patched version at any of the following:

- https://bitbucket.org/dkuhlman/generateds

- https://pypi.python.org/pypi/generateDS

- https://sourceforge.net/projects/generateds/

Thank you for reporting this.  I appreciate your help.

Dave

On Thu, Dec 07, 2017 at 01:51:28PM +0100, Rohan Dsa wrote:
> Dave,
> 
> I need to keep changing a line in my auto generated code.
> 
> from StringIO import StringIO
> 
> to
> 
> from io import StringIO
> 
> The code runs only under Python3. is this normal or am i missing something?
> I would have posted this somewhere, just didn't find any bugtracker online.
> 
> Rohan

-- 

Dave Kuhlman
http://www.davekuhlman.org
diff -r 7748855b08f6 generateDS.py
--- a/generateDS.py     Thu Dec 07 14:11:03 2017 -0800
+++ b/generateDS.py     Thu Dec 07 14:38:23 2017 -0800
@@ -6337,7 +6337,10 @@
 
 
 def parseString(inString, silence=False):
-    from StringIO import StringIO
+    if sys.version_info.major == 2:
+        from StringIO import StringIO
+    else:
+        from io import BytesIO as StringIO
 %(preserve_cdata_tags)s    doc = parsexml_(StringIO(inString), parser)
     rootNode = doc.getroot()
     rootTag, rootClass = get_root_tag(rootNode)
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to