Menu

#32 Broken inheritance when generating code

1.0
open
nobody
None
2022-06-10
2022-06-09
No

Hello!

I have been testing the people library, but when running python people.py people.xml I receive the following error:

Traceback (most recent call last):
  File "people.py", line 4390, in <module>
    main()
  File "people.py", line 4383, in main
    parse(args[0])
  File "people.py", line 4253, in parse
    rootObj.build(rootNode, gds_collector_=gds_collector)
  File "people.py", line 1196, in build
    self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
  File "people.py", line 1203, in _buildChildren
    obj_.build(child_, gds_collector_=gds_collector_)
  File "people.py", line 1368, in build
    self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
  File "people.py", line 1375, in _buildChildren
    valuestr_ = self.gds_parse_string(valuestr_, node, 'emp')
AttributeError: 'commentsType' object has no attribute 'gds_parse_string'

The generated “commentsType” class appears to be a subclass of GeneratedsSuper, so it should have visibility on gds_parse_string. Is this a bug or am I doing something wrong?

Many thanks!

Pablo

Discussion

  • Dave Kuhlman

    Dave Kuhlman - 2022-06-09

    Pablo,

    I'm trying to reproduce the exception that you've reported.

    Here's what I've done:

    1. I copied people.xsd and people.xml from generateds/tests in
      the source code distribution.

    2. I generated a module with this:

      $ ./generateDS.py -o people.py people.xsd

    3. I ran that module against people.xml:

      $ python people.py people.xml

    The above ran successfully and produced output.

    There are also people.xsd and people.xml in the
    generateds/Demos/People subdirectory. In order to run a test with
    those, you need to use the run-full-test.sh shell script (or a
    modified version of it for Windows, I suppose). That also runs
    successfully.

    So, we need to figure out what you are doing that is different from
    what I've done.

    Question 1: Can you suggest something that I can do to reproduce
    your exception?

    Question 2: Are you using people.xsd and people.xml that are
    different from the ones I've tested with? If so, where did you get
    people.xsd and people.xml?

    Question 3: Can you think of anything else that I am doing that is
    different from your test and that might cause that exception?

    Dave

     
  • Dave Kuhlman

    Dave Kuhlman - 2022-06-10

    One more question: What command line flags did you use when you ran generateDS.py (or generateds)? What were the commands that you ran for your test? Perhaps you could copy and paste them in a reply.

    In general, I'm groping for any information that would enable me to reproduce the error.

    Dave

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.