[x3d-public] x3d.py problem validating MFVec2f default value, other fixes applied, version 4.0.64.1 released
John Carlson
yottzumm at gmail.com
Mon Jun 13 05:19:48 PDT 2022
Follow-on report, I will look into arc4.py
python ../python/x3djsonld.py ../data/arc4.json
../python/net/coderextreme/data/arc4.py
Traceback (most recent call last):
File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 4961, in
assertValidMFVec3f
MFVec3f(value)
File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 9559, in
__init__
self.value = value
File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 9581, in value
value = [(x, y, z) for x, y, z in value]
File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 9581, in
<listcomp>
value = [(x, y, z) for x, y, z in value]
TypeError: cannot unpack non-iterable int object
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File
"C:\Users\john\X3DJSONLD\src\main\python\net\coderextreme\data\arc4.py",
line 24, in <module>
field(name="keyValue", accessType="inputOutput", type="MFVec3f",
value=[0,0,0,0,5,0])
File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 12272, in
__init__
self.value = value
File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 12342, in
value
assertValidFieldInitializationValue(self.name, self.type, value,
parent='field/@value')
File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 5413, in
assertValidFieldInitializationValue
assertValidMFVec3f(value)
File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 4965, in
assertValidMFVec3f
raise X3DTypeError(str(value)[:100] + ' has type ' + str(type(value)) +
' but is not a valid MFVec3f') from error
x3d.X3DTypeError: [0, 0, 0, 0, 5, 0] has type <class 'list'> but is not a
valid MFVec3f
Error: ../python/net/coderextreme/data/arc4.py failed to parse
On Sun, Jun 12, 2022 at 8:40 PM Brutzman, Donald (Don) (CIV) <
brutzman at nps.edu> wrote:
> John, thanks for various problem reports and example corrections, very
> helpful.
>
>
> Am happy to report integration of multiple fixes, and deployment of new
> version.
>
>
>
> 1. I eventually figured out how to fix the upgrade to Saxon HE 11.3
> not working, which required addition of xmlresolver jar to CLASSPATH
> entries. This unblocked many mysterious build problems. Apparently
> followed a solution path you had figured out too. Details at
>
>
>
> - https://saxonica.plan.io/boards/3/topics/8478?r=8480
> - https://sourceforge.net/p/x3d/code/33141
>
>
>
> 1. You correctly reported missing HANIMVERSIONCHOICES and
> assertValidHanimVersion() in the updated build. Cause was our recently
> disallowing HAnim version 1.0 in X3D4 since several internal design issues
> were incompatible in HAnim 2.0 and thus X3D4. Thus only HAnim version 2.0
> is now allowed. This was previously fixed in X3D Schema, now also fixed in
> X3D DTD and X3D Tooltips and X3DUOM. The generator stylesheet for x3d now
> included enumeration lists with only one value, restoring these HANIM
> version constructs.
>
>
> - Mantis 641: 26.3.2 - HAnim version number restriction
> - https://www.web3d.org/member-only/mantis/view.php?id=641
> -
> https://www.web3d.org/specifications/X3dDoctypeDocumentation4.0.html#HAnimHumanoid
> -
> https://www.web3d.org/specifications/X3dSchemaDocumentation4.0/x3d-4.0_HAnimHumanoid.html#Link45B
> -
> https://www.web3d.org/x3d/tooltips/X3dTooltips.html#HAnimHumanoid.version
>
>
>
> 1. Also thanks for following report. The x3d.py problem validating
> default values for MFVec2f (such as Extrusion crossSection) and other MFVec
> default values (such as Extrusion spine) is now fixed in the X3DPSAIL
> autogeneration of x3d.py. Excerpt follows, hopefully fixing the test cases
> you have. I believe such conversions from long arrays to arrays of typed
> tuples is already working in X3dToJson.xslt conversions, so this resolution
> improved x3d.py itself.
>
>
> - class Extrusion(_X3DGeometryNode):
>
> […]
>
> ('crossSection', [(1, 1), (1, -1), (-1, -1), (-1, 1), (1, 1)],
> FieldType.MFVec2f, AccessType.initializeOnly, 'Extrusion'),
>
> […]
>
> ('spine', [(0, 0, 0), (0, 1, 0)], FieldType.MFVec3f,
> AccessType.initializeOnly, 'Extrusion'),
>
> […]
>
> crossSection = [(1, 1), (1, -1), (-1, -1), (-1, 1), (1, 1)] # default
>
> […]
>
> spine = [(0, 0, 0), (0, 1, 0)] # default
>
> - etc.
>
>
>
> 1. Not yet announced broadly, pending ISO/IEC confirmation of
> acceptance, but have changed internal documentation links in X3DUOM and
> related products for X3D4 Architecture to change from Committee Draft 1
> (CD1) to Draft International Specification (DIS). Note that all of the
> effective specification prose is functionally identical, and all
> Mantis-driven changes for 4.0 are resolved. The only document modification
> is removal of CSS-styled markings of proposed additions and proposed
> deletions.
>
>
> -
> https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/Architecture.html
>
> to
>
> -
> https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-DIS/Part01/Architecture.html
>
>
>
> 1. Pylint log still reports some warnings, but “code has been rated at
> 9.97/10” and yesterday’s overnight build to convert all X3D models in X3D
> Examples Archive was pretty clean. Steady improvement. 8)
>
>
> - https://www.web3d.org/x3d/stylesheets/python/build.pylint.log.txt
> - https://www.web3d.org/x3d/content/examples/build.python.all.log.txt
>
>
>
> 1. Am using Python 3.10.4. Have checked in all X3DPSAIL improvements
> and deployed new x3d.py package version 4.0.64.1, passing acceptance tests
> on this end. Hopefully working well for you too. The TODO section seems
> mostly current, further improvements always welcome.
>
>
> - https://pypi.org/project/x3d
> - https://www.web3d.org/x3d/stylesheets/python/python.html
> - https://www.web3d.org/x3d/stylesheets/python/python.html#TODO
>
>
>
> 1. Just noticed that Python itself issued a new release 3.10.5 a week
> ago. Will post again when that upgrade is tested.
>
>
> - Python 3.10.5. Release Date: June 6, 2022
> - https://www.python.org/downloads/release/python-3105
>
>
>
> Again thanks for your excellent problem reports and example fixes. Have
> fun with X3D Python! 8)
>
>
>
> all the best, Don
>
> --
>
> Don Brutzman Naval Postgraduate School, Code USW/Br
> brutzman at nps.edu
>
> Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA
> +1.831.656.2149
>
> X3D graphics, virtual worlds, Navy robotics https://
> faculty.nps.edu/brutzman
>
>
>
> *From:* John Carlson <yottzumm at gmail.com>
> *Sent:* Thursday, June 9, 2022 2:21 AM
> *To:* Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>; X3D Graphics
> public mailing list <x3d-public at web3d.org>
> *Subject:* x3d.py problem validating MFVec2f (non-specified crossSection)
> default value
>
>
>
> The most important thing is last in this email, problems validating
> default MFVec2f crossSection field in x3d.py. The rest of the email is
> background.
>
>
>
> To get x3d.py (x3djsonld.py) to handle HelloWorldProgramOutput.json, I
> had to remove Extrusions from the example, and change to Spheres.
>
>
>
> Below is the change to the example to make it work:
>
>
>
> diff /c/x3d-code/
> www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.json
> HelloWorldProgramOutput.json
> 1135c1135
> < { "Extrusion":
> ---
> > { "Sphere":
> 2392c2392
> < { "Extrusion":
> ---
> > { "Sphere":
> 2693c2693
> < }
> \ No newline at end of file
> ---
> > }
>
> ============================================================
>
> If one does not make the change to the JSON file, the following error
> appears. x3djsonld.py is in X3DJSONLD/src/main/python.
>
>
>
> $ python x3djsonld.py
> '''
> x3d.py package 4.0.63.7 loaded, have fun with X3D Graphics!
> '''
> from x3d import *
> from x3d import SFBool
> print(
> Traceback (most recent call last):
> File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 4668, in
> assertValidMFVec2f
> MFVec2f(value)
> File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 9184, in
> __init__
> self.value = value
> File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 9206, in
> value
> value = [(x, y) for x, y, in value]
> File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 9206, in
> <listcomp>
> value = [(x, y) for x, y, in value]
> ValueError: too many values to unpack (expected 2)
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
> File "C:\Users\john\X3DJSONLD\src\main\python\x3djsonld.py", line 256,
> in <module>
> print(parseObject("X3D", data, 0))
> File "C:\Users\john\X3DJSONLD\src\main\python\x3djsonld.py", line 178,
> in parseObject
> out += parseObject(k, v,indent+1)
> File "C:\Users\john\X3DJSONLD\src\main\python\x3djsonld.py", line 163,
> in parseObject
> out += parseObject(k, v,indent+1)
> File "C:\Users\john\X3DJSONLD\src\main\python\x3djsonld.py", line 192,
> in parseObject
> out += parseArray("[", "]", parent, key, v,indent+1, fieldType)
> File "C:\Users\john\X3DJSONLD\src\main\python\x3djsonld.py", line 57, in
> parseArray
> out += parseObject(parent, d,indent+1)
> File "C:\Users\john\X3DJSONLD\src\main\python\x3djsonld.py", line 178,
> in parseObject
> out += parseObject(k, v,indent+1)
> File "C:\Users\john\X3DJSONLD\src\main\python\x3djsonld.py", line 175,
> in parseObject
> out += parseObject(k, v,indent+1)
> File "C:\Users\john\X3DJSONLD\src\main\python\x3djsonld.py", line 178,
> in parseObject
> out += parseObject(k, v,indent+1)
> File "C:\Users\john\X3DJSONLD\src\main\python\x3djsonld.py", line 125,
> in parseObject
> fieldInfo = getField(parent, key)
> File "C:\Users\john\X3DJSONLD\src\main\python\x3djsonld.py", line 14, in
> getField
> cls = eval(grandparent)()
> File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 38948, in
> __init__
> self.crossSection = crossSection
> File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 39005, in
> crossSection
> assertValidMFVec2f(crossSection)
> File "C:\Users\john\X3DJSONLD\src\main\python\x3d.py", line 4672, in
> assertValidMFVec2f
> raise X3DTypeError(str(value)[:100] + ' has type ' + str(type(value))
> + ' but is not a valid MFVec2f') from error
> x3d.X3DTypeError: [(1, 1, 1, -1, -1, -1, -1, 1, 1, 1)] has type <class
> 'list'> but is not a valid MFVec2f
>
> ============================================================
>
> What's wrong with the is handling the Extrusion when crossSection is not
> set, thus x3d.py:
>
>
>
> @crossSection.setter
> def crossSection(self, crossSection):
> if crossSection is None:
> crossSection = [(1, 1, 1, -1, -1, -1, -1, 1, 1, 1)] # default
> assertValidMFVec2f(crossSection)
> self.__crossSection = crossSection
>
>
>
> Note that crossSection's default is not correct.
>
>
>
> Thanks for any fixes to x3d.py. I will try to fix it now.
>
>
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220613/5db54989/attachment-0001.html>
More information about the x3d-public
mailing list