Skip to content

Issues with ProtoBody setter #1

@coderextreme

Description

@coderextreme

Please check code from @ProtoBody.setter in https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/python/x3d.py
below (inside the isinstance() call):

    def ProtoBody(self, ProtoBody):
        if  ProtoBody is None:
            ProtoBody = None # default
        assertValidSFNode(ProtoBody)
        if not ProtoBody is None and not isinstance(ProtoBody,(ProtoBody,ProtoInstance)):
            # print(flush=True)
            raise X3DTypeError(str(ProtoBody) + ' does not match required node type (ProtoBody,ProtoInstance) and is invalid')
        self.__ProtoBody = ProtoBody

What this means to me is that ProtoBody is both being used as parameter and a type.

This has severe impact on testing X3dToPython.xslt, because nearly a third of my test files are affected.

Here is the error thrown:

$ python3 abox.py 
x3d.py package loaded, have fun with X3D Graphics!
Traceback (most recent call last):
  File "abox.py", line 35, in <module>
    ProtoDeclare(name='anyShape',
  File "/home/coderextreme/X3DJSONLD/src/main/python/net/x3djsonld/data/x3d.py", line 10239, in __init__
    self.ProtoBody = ProtoBody
  File "/home/coderextreme/X3DJSONLD/src/main/python/net/x3djsonld/data/x3d.py", line 10282, in ProtoBody
    if not ProtoBody is None and not isinstance(ProtoBody,(ProtoBody,ProtoInstance)):
TypeError: isinstance() arg 2 must be a type or tuple of types

John

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions