[x3d-public] Next, in Python news...

John Carlson yottzumm at gmail.com
Mon Aug 30 17:06:06 PDT 2021


Don, as far as I know, the issue is with constructing the ProtoDeclare
scenegraph.   I don’t see how I can generate XML, VRML or JSON if
construction doesn’t work.

I fully realize that ECMAScript Protos take a different approach.   I’m
wondering what will be standardized, or will both approaches be acceptable?
  If there’s an XML or VRML *parser* let’s use it!

Thumbs up!

On Sat, Aug 21, 2021 at 11:57 PM Brutzman, Donald (Don) (CIV) <
brutzman at nps.edu> wrote:

> Hi John, am trying to follow your message.
>
> We have pylint but recent upgrade to python caused a gap, not resolved yet.
>
> Meanwhile python evaluates everything building the scene graph quite
> strictly, primarily through setters when creating values.  I'm not sure it
> is possible to create invalid XML, VRML or JSON from x3d.py package.  If
> such a case is found, let's fix the bug it indicates.
>
> If you have an example python program/snippet that does _not_ produce
> valid XML, VRML or JSON, please advise.
>
> v/r Don
>
>
> -----Original Message-----
> From: x3d-public <x3d-public-bounces at web3d.org> On Behalf Of John Carlson
> Sent: Saturday, August 21, 2021 3:10 AM
> To: X3D Graphics public mailing list <x3d-public at web3d.org>
> Subject: [x3d-public] Next, in Python news...
>
> I've been converting JSON schema to pure python validators (no separate
> JSON schema file required) with a python package (not mine).  If I could
> convert X3DUOM to Python and get a free XML, VRML, and JSON schema
> validation in Python, that would WOW me. BTW, I see that you don't use an
> XML parser in Python yet?  May I recommend the popular ElementTree built-in
> package.  Here's a simple pattern (in python):
>
> import xml.etree.ElementTree
> soup =
>
> xml.etree.ElementTree.parse(open("../../specifications/X3dUnifiedObjectModel-4.0.xml")).getroot()
>
> So, Don should look at pylint output in the logs, perhaps? Me too!  I just
> found out about pylint!  I can find bugs in Python while Don works on
> Python-creating XSLT?   That would seem a better division of labor. I just
> ran ```ant pylint```.  I can do that and search for bugs in x3d.py.  I see
> that my changes are 1.53/10 worse, so I'm backing the changes that I made
> to X3duomToX3dPythonPackage.xslt. Please revisit this email, or look at
> code I pasted below.  The problem is around isinstance.  I could be
> misunderstanding duck typing.  To me, 2 ProtoBody's inside the isinstance
> parameters spells trouble, but I'm unsure of a fix at this point.  I have a
> backup of my changes should we need to recover.  Perhaps a step forward is
> better than a step backwards?
>
>      @ProtoBody.setter
>      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
>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210830/7aadd351/attachment.html>


More information about the x3d-public mailing list