[x3d-public] need help installing python (x3d.py) on Kubuntu Groovy Gorilla

John Carlson yottzumm at gmail.com
Thu Jan 21 00:54:48 PST 2021


Now getting this:

coderextreme at coderextreme-Kubuntu20:/c/x3d-code/www.web3d.org/x3d/stylesheets/python

$ python examples/HelloWorld.py
Traceback (most recent call last):
   File "examples/HelloWorld.py", line 21, in <module>
     from x3d import *
AttributeError: 'module' object has no attribute 'SFBool'


John

On 1/21/21 2:16 AM, John Carlson wrote:
> Set up encoding.  Modified x3d.py at head of file:
>
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
>
> Now getting this:
>
>
> python HelloWorld.py
> Traceback (most recent call last):
>   File "HelloWorld.py", line 23, in <module>
>     from x3d import *
>   File 
> "/home/coderextreme/X3DJSONLD/src/main/python/net/x3djsonld/data/x3d.py", 
> line 1992
>     print('* isValidMFColor tuple ' + str(each) + ' has length ' + 
> str(len(each)) + ' which is not a multiple of MFColor().TUPLE_SIZE()=' 
> + str(MFColor().TUPLE_SIZE()) + ' for value=' + str(value), flush=True)
> ^
> SyntaxError: invalid syntax
>
> On 1/21/21 2:04 AM, John Carlson wrote:
>> I figured out I needed to set PYTHONPATH just as I sent previous 
>> email. Duh!
>>
>> Now running into this.  From what I've read, it's due to not setting 
>> the encoding in the python file (see http link below). Mentioned in a 
>> prior message too.
>>
>>
>> John
>>
>>      [echo] ###############################################
>>      [echo] # Self-test diagnostics
>>      [echo] ###############################################
>>      [echo]
>>      [echo] if        metaDiagnostics(newModel): # built-in utility 
>> method in X3D class
>>      [echo]     print(metaDiagnostics(newModel))
>>      [echo] print('check  newModel.XML() serialization...')
>>      [echo] newModelXML = newModel.XML() # test export method XML() 
>> for exceptions
>>      [echo] # print(newModelXML) # debug
>>      [echo]
>>      [echo] print ("python x3d.py load successful for 
>> BackgroundCollection.py")
>>      [echo] ===========================================
>>      [echo] Loading local x3d.py package in python to check for 
>> correctness...
>>      [echo]   then test BackgroundCollection.py execution and 
>> self-validation:
>>      [echo]   python examples/BackgroundCollection.py
>>      [exec] Traceback (most recent call last):
>>      [exec]   File "examples/BackgroundCollection.py", line 21, in 
>> <module>
>>      [exec]     from x3d import *
>>      [exec]   File 
>> "/c/x3d-code/www.web3d.org/x3d/stylesheets/python/x3d/x3d.py", line 269
>>      [exec] SyntaxError: Non-ASCII character '\xc3' in file 
>> /c/x3d-code/www.web3d.org/x3d/stylesheets/python/x3d/x3d.py on line 
>> 269, but no encoding declared; see 
>> http://python.org/dev/peps/pep-0263/ for details
>>      [exec] Result: 1
>>      [echo] convert.X3dToPython.xslt conversion of 
>> BackgroundCollection.x3d to BackgroundCollection.py complete.
>>      [echo] ===========================================
>>
>> BUILD SUCCESSFUL
>> Total time: 5 seconds
>>
>>
>> On 1/21/21 1:59 AM, John Carlson wrote:
>>>  Do I just need privileges?  Or should there be an encoding at the 
>>> top of python files?
>>>
>>> Can someone repeat this?  I'm finding it hard to read ant output.
>>>
>>> (also, there is an ant target create.X3DPSAIL)
>>>
>>> $ pip install x3d
>>> Requirement already satisfied: x3d in 
>>> /home/coderextreme/.local/lib/python3.8/site-packages (0.0.37)
>>>
>>> $ ant test.X3DPSAIL
>>> Buildfile: /c/x3d-code/www.web3d.org/x3d/stylesheets/build.xml
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> test.X3DPSAIL:
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> test.x3d.py.local:
>>>      [echo] Loading local x3d.py package in python to check for 
>>> correctness...
>>>      [echo] $X3dPackageSubdirectory=x3d, 
>>> $X3dPackageSubdirectoryLocation=/c/x3d-code/www.web3d.org/x3d/stylesheets/python/x3d
>>>      [exec] python: can't open file 'x3d.py': [Errno 2] No such file 
>>> or directory
>>>      [exec] Result: 2
>>>      [echo] ===========================================
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> versions:
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> versions:
>>>      [echo] ant -version
>>>      [exec] Apache Ant(TM) version 1.10.9 compiled on September 27 2020
>>>      [echo] java -version
>>>      [exec] openjdk version "15" 2020-09-15
>>>      [exec] OpenJDK Runtime Environment (build 15+36-Ubuntu-1)
>>>      [exec] OpenJDK 64-Bit Server VM (build 15+36-Ubuntu-1, mixed 
>>> mode, sharing)
>>>      [echo] python -version
>>>      [exec] Python 2.7.18
>>>      [echo] saxon -? help
>>>      [echo]
>>>      [echo]   ANT_HOME=${env.ANT_HOME}
>>>      [echo]  JAVA_HOME=${env.JAVA_HOME}
>>>      [echo] PYTHONHOME=${env.PYTHONHOME}
>>>      [echo] PYTHONPATH=${env.PYTHONPATH}
>>>      [echo] Check for X3DJSAIL X3DJSAIL.4.0.full.jar or 
>>> X3DJSAIL.4.0.classes.jar
>>>      [echo] CLASSPATH=${env.CLASSPATH}
>>>      [echo] javac source/target      $java.source=1.8
>>>      [echo] Java/JVM version    $ant.java.version=15
>>>      [echo] Java/JVM detail version $java.version=15
>>>      [echo] Ant version              $ant.version=Apache Ant(TM) 
>>> version 1.10.9 compiled on September 27 2020
>>>      [echo] Check for node.js installation from https://nodejs.org
>>>      [exec] v12.18.2
>>>      [echo] Configuration settings: 
>>> https://savage.nps.edu/Savage/developers.html
>>>      [echo] ===========================================
>>>
>>> examples:
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> set.local.PYTHONPATH:
>>>      [echo] local.PYTHONPATH=x3d
>>>
>>> test.x3d.py:
>>>      [echo] Loading active PYTHONPATH x3d.py package in python to 
>>> check for correctness...
>>>      [exec] python: can't open file 'x3d.py': [Errno 2] No such file 
>>> or directory
>>>      [exec] Result: 2
>>>      [echo] ===========================================
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> examples.HelloWorld.prefixed:
>>>      [echo] Convert and test verbose approach using 
>>> HelloWorldPrefixed.py
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> convert.X3dToPython.xslt.prefixed:
>>>    [delete] Deleting: 
>>> /c/x3d-code/www.web3d.org/x3d/stylesheets/python/examples/HelloWorldPrefixed.py
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> set.local.PYTHONPATH:
>>>      [echo] local.PYTHONPATH=x3d
>>>
>>> convert.X3dToPython.xslt:
>>>      [echo] ===========================================
>>>    [delete] Deleting 
>>> /c/x3d-code/www.web3d.org/x3d/stylesheets/python/examples/HelloWorld.py
>>>      [echo] ===========================================
>>>      [echo] convert.X3dToPython.xslt conversion of HelloWorld.x3d to 
>>> HelloWorld.py complete.
>>>      [echo] ###############################################
>>>      [echo] #
>>>      [echo] # Now available: developmental python x3d.py package on 
>>> PyPi for import.
>>>      [echo] #   This approach greatly simplifies Python X3D 
>>> deployment and use.
>>>      [echo] #   https://pypi.org/project/x3d
>>>      [echo] #
>>>      [echo] # Installation:
>>>      [echo] #       pip install x3d
>>>      [echo] # or
>>>      [echo] #       python -m pip install x3d
>>>      [echo] #
>>>      [echo] # Developer options for loading x3d package:
>>>      [echo] #
>>>      [echo] #    from x3d import *  # preferred approach, terser 
>>> source that avoids x3d.* class prefixes
>>>      [echo] #
>>>      [echo] # or
>>>      [echo] #    import x3d         # traditional way to subclass 
>>> x3d package, all classes require x3d.* prefix
>>>      [echo] #                       # but python source is very 
>>> verbose, for example x3d.Material x3d.Shape etc.
>>>      [echo] #                       # X3dToPython.xslt stylesheet 
>>> insertPackagePrefix=true supports this option.
>>>      [echo]
>>>      [echo] import x3d
>>>      [echo]
>>>      [echo] ###############################################
>>>      [echo]
>>>      [echo] #  comment preceding root node
>>>      [echo] newModel=x3d.X3D(profile='Immersive',version='3.3',
>>>      [echo]   head=x3d.head(
>>>      [echo]     children=[
>>>      [echo] x3d.meta(content='HelloWorld.x3d',name='title'),
>>>      [echo]     x3d.meta(content='Simple X3D scene example: Hello 
>>> World!',name='description'),
>>>      [echo]     x3d.meta(content='30 October 2000',name='created'),
>>>      [echo]     x3d.meta(content='31 October 2019',name='modified'),
>>>      [echo]     x3d.meta(content='Don Brutzman',name='creator'),
>>>      [echo] x3d.meta(content='HelloWorld.tall.png',name='Image'),
>>>      [echo] 
>>> x3d.meta(content='http://en.wikipedia.org/wiki/Hello_world',name='reference'),
>>>      [echo] 
>>> x3d.meta(content='https://en.wikipedia.org/wiki/Hello#.22Hello.2C_World.22_computer_program',name='reference'),
>>>      [echo] 
>>> x3d.meta(content='https://en.wikipedia.org/wiki/"Hello,_World!"_program',name='reference'),
>>>      [echo] 
>>> x3d.meta(content='http://en.wikibooks.org/w/index.php?title=Computer_Programming/Hello_world',name='reference'),
>>>      [echo] 
>>> x3d.meta(content='http://www.HelloWorldExample.net',name='reference'),
>>>      [echo] x3d.meta(content='http://www.web3D.org',name='reference'),
>>>      [echo] 
>>> x3d.meta(content='http://www.web3d.org/realtime-3d/news/internationalization-x3d',name='reference'),
>>>      [echo] 
>>> x3d.meta(content='http://www.web3d.org/x3d/content/examples/HelloWorld.x3d',name='reference'),
>>>      [echo] 
>>> x3d.meta(content='http://X3dGraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes',name='reference'),
>>>      [echo] 
>>> x3d.meta(content='http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.x3d',name='identifier'),
>>>      [echo] 
>>> x3d.meta(content='http://www.web3d.org/x3d/content/examples/license.html',name='license'),
>>>      [echo]     x3d.meta(content='X3D-Edit 3.3, 
>>> https://savage.nps.edu/X3D-Edit',name='generator'),
>>>      [echo]     #  Alternate encodings: VRML97, X3D ClassicVRML 
>>> Encoding, X3D Compressed Binary Encoding (CBE), X3DOM, JSON
>>>      [echo] x3d.meta(content='HelloWorld.wrl',name='reference'),
>>>      [echo] x3d.meta(content='HelloWorld.x3dv',name='reference'),
>>>      [echo] x3d.meta(content='HelloWorld.x3db',name='reference'),
>>>      [echo] x3d.meta(content='HelloWorld.xhtml',name='reference'),
>>>      [echo] x3d.meta(content='HelloWorld.json',name='reference')]),
>>>      [echo]   Scene=x3d.Scene(
>>>      [echo]     #  Example scene to illustrate X3D nodes and fields 
>>> (XML elements and attributes)
>>>      [echo]     children=[
>>>      [echo]     x3d.WorldInfo(title='Hello World!'),
>>>      [echo]     x3d.Group(
>>>      [echo]       children=[
>>>      [echo] 
>>> x3d.Viewpoint(DEF='ViewUpClose',centerOfRotation=(0,-1,0),description='Hello 
>>> world!',position=(0,-1,7)),
>>>      [echo]       #  insert commas to test removal when converted to 
>>> ttl
>>>      [echo] 
>>> x3d.Transform(DEF='TestWhitespaceCommas',rotation=(0,1,0,3),
>>>      [echo]         children=[
>>>      [echo]         x3d.Shape(
>>>      [echo]           geometry=x3d.Sphere(),
>>>      [echo]           appearance=x3d.Appearance(
>>>      [echo] 
>>> material=x3d.Material(DEF='MaterialLightBlue',diffuseColor=(0.1,0.5,1)), 
>>>
>>>      [echo] 
>>> texture=x3d.ImageTexture(DEF='ImageCloudlessEarth',url=["earth-topo.png","earth-topo.jpg","earth-topo-small.gif","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.png","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg","http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif"])))]),
>>>      [echo]       x3d.Transform(translation=(0,-2,0),
>>>      [echo]         children=[
>>>      [echo]         x3d.Shape(
>>>      [echo] 
>>> geometry=x3d.Text(DEF='TextMessage',string=["Hello","world!"],
>>>      [echo] fontStyle=x3d.FontStyle(justify=["MIDDLE","MIDDLE"])),
>>>      [echo]           appearance=x3d.Appearance(
>>>      [echo] material=x3d.Material(USE='MaterialLightBlue')))])])])
>>>      [echo] ) # X3D model complete
>>>      [echo]
>>>      [echo] ###############################################
>>>      [echo] # Self-test diagnostics
>>>      [echo] ###############################################
>>>      [echo]
>>>      [echo] if        x3d.metaDiagnostics(newModel): # built-in 
>>> utility method in X3D class
>>>      [echo]     print(x3d.metaDiagnostics(newModel))
>>>      [echo] print('check  newModel.XML() serialization...')
>>>      [echo] newModelXML = newModel.XML() # test export method XML() 
>>> for exceptions
>>>      [echo] # print(newModelXML) # debug
>>>      [echo]
>>>      [echo] print ("python x3d.py load successful for HelloWorld.py")
>>>      [echo] ===========================================
>>>      [echo] Loading local x3d.py package in python to check for 
>>> correctness...
>>>      [echo]   then test HelloWorld.py execution and self-validation:
>>>      [echo]   python examples/HelloWorld.py
>>>      [exec] Traceback (most recent call last):
>>>      [exec]   File "examples/HelloWorld.py", line 21, in <module>
>>>      [exec]     import x3d
>>>      [exec] ImportError: No module named x3d
>>>      [exec] Result: 1
>>>      [echo] convert.X3dToPython.xslt conversion of HelloWorld.x3d to 
>>> HelloWorld.py complete.
>>>      [echo] ===========================================
>>>      [move] Moving 1 file to 
>>> /c/x3d-code/www.web3d.org/x3d/stylesheets/python/examples
>>>      [move] Attempting to rename: 
>>> /c/x3d-code/www.web3d.org/x3d/stylesheets/python/examples/HelloWorld.py 
>>> to 
>>> /c/x3d-code/www.web3d.org/x3d/stylesheets/python/examples/HelloWorldPrefixed.py
>>>      [echo] ===========================================
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> examples.HelloWorld:
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> set.local.PYTHONPATH:
>>>      [echo] local.PYTHONPATH=x3d
>>>
>>> convert.X3dToPython.xslt:
>>>      [echo] ===========================================
>>>      [echo] ===========================================
>>>      [echo] convert.X3dToPython.xslt conversion of HelloWorld.x3d to 
>>> HelloWorld.py complete.
>>>      [echo] ###############################################
>>>      [echo] #
>>>      [echo] # Now available: developmental python x3d.py package on 
>>> PyPi for import.
>>>      [echo] #   This approach greatly simplifies Python X3D 
>>> deployment and use.
>>>      [echo] #   https://pypi.org/project/x3d
>>>      [echo] #
>>>      [echo] # Installation:
>>>      [echo] #       pip install x3d
>>>      [echo] # or
>>>      [echo] #       python -m pip install x3d
>>>      [echo] #
>>>      [echo] # Developer options for loading x3d package:
>>>      [echo] #
>>>      [echo] #    from x3d import *  # preferred approach, terser 
>>> source that avoids x3d.* class prefixes
>>>      [echo] #
>>>      [echo] # or
>>>      [echo] #    import x3d         # traditional way to subclass 
>>> x3d package, all classes require x3d.* prefix
>>>      [echo] #                       # but python source is very 
>>> verbose, for example x3d.Material x3d.Shape etc.
>>>      [echo] #                       # X3dToPython.xslt stylesheet 
>>> insertPackagePrefix=true supports this option.
>>>      [echo]
>>>      [echo] from x3d import *
>>>      [echo]
>>>      [echo] ###############################################
>>>      [echo]
>>>      [echo] #  comment preceding root node
>>>      [echo] newModel=X3D(profile='Immersive',version='3.3',
>>>      [echo]   head=head(
>>>      [echo]     children=[
>>>      [echo]     meta(content='HelloWorld.x3d',name='title'),
>>>      [echo]     meta(content='Simple X3D scene example: Hello 
>>> World!',name='description'),
>>>      [echo]     meta(content='30 October 2000',name='created'),
>>>      [echo]     meta(content='31 October 2019',name='modified'),
>>>      [echo]     meta(content='Don Brutzman',name='creator'),
>>>      [echo] meta(content='HelloWorld.tall.png',name='Image'),
>>>      [echo] 
>>> meta(content='http://en.wikipedia.org/wiki/Hello_world',name='reference'),
>>>      [echo] 
>>> meta(content='https://en.wikipedia.org/wiki/Hello#.22Hello.2C_World.22_computer_program',name='reference'),
>>>      [echo] 
>>> meta(content='https://en.wikipedia.org/wiki/"Hello,_World!"_program',name='reference'),
>>>      [echo] 
>>> meta(content='http://en.wikibooks.org/w/index.php?title=Computer_Programming/Hello_world',name='reference'),
>>>      [echo] 
>>> meta(content='http://www.HelloWorldExample.net',name='reference'),
>>>      [echo] meta(content='http://www.web3D.org',name='reference'),
>>>      [echo] 
>>> meta(content='http://www.web3d.org/realtime-3d/news/internationalization-x3d',name='reference'),
>>>      [echo] 
>>> meta(content='http://www.web3d.org/x3d/content/examples/HelloWorld.x3d',name='reference'),
>>>      [echo] 
>>> meta(content='http://X3dGraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes',name='reference'),
>>>      [echo] 
>>> meta(content='http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.x3d',name='identifier'),
>>>      [echo] 
>>> meta(content='http://www.web3d.org/x3d/content/examples/license.html',name='license'),
>>>      [echo]     meta(content='X3D-Edit 3.3, 
>>> https://savage.nps.edu/X3D-Edit',name='generator'),
>>>      [echo]     #  Alternate encodings: VRML97, X3D ClassicVRML 
>>> Encoding, X3D Compressed Binary Encoding (CBE), X3DOM, JSON
>>>      [echo] meta(content='HelloWorld.wrl',name='reference'),
>>>      [echo] meta(content='HelloWorld.x3dv',name='reference'),
>>>      [echo] meta(content='HelloWorld.x3db',name='reference'),
>>>      [echo] meta(content='HelloWorld.xhtml',name='reference'),
>>>      [echo] meta(content='HelloWorld.json',name='reference')]),
>>>      [echo]   Scene=Scene(
>>>      [echo]     #  Example scene to illustrate X3D nodes and fields 
>>> (XML elements and attributes)
>>>      [echo]     children=[
>>>      [echo]     WorldInfo(title='Hello World!'),
>>>      [echo]     Group(
>>>      [echo]       children=[
>>>      [echo] 
>>> Viewpoint(DEF='ViewUpClose',centerOfRotation=(0,-1,0),description='Hello 
>>> world!',position=(0,-1,7)),
>>>      [echo]       #  insert commas to test removal when converted to 
>>> ttl
>>>      [echo] Transform(DEF='TestWhitespaceCommas',rotation=(0,1,0,3),
>>>      [echo]         children=[
>>>      [echo]         Shape(
>>>      [echo]           geometry=Sphere(),
>>>      [echo]           appearance=Appearance(
>>>      [echo] 
>>> material=Material(DEF='MaterialLightBlue',diffuseColor=(0.1,0.5,1)),
>>>      [echo] 
>>> texture=ImageTexture(DEF='ImageCloudlessEarth',url=["earth-topo.png","earth-topo.jpg","earth-topo-small.gif","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.png","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg","http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif"])))]),
>>>      [echo]       Transform(translation=(0,-2,0),
>>>      [echo]         children=[
>>>      [echo]         Shape(
>>>      [echo] geometry=Text(DEF='TextMessage',string=["Hello","world!"],
>>>      [echo] fontStyle=FontStyle(justify=["MIDDLE","MIDDLE"])),
>>>      [echo]           appearance=Appearance(
>>>      [echo] material=Material(USE='MaterialLightBlue')))])])])
>>>      [echo] ) # X3D model complete
>>>      [echo]
>>>      [echo] ###############################################
>>>      [echo] # Self-test diagnostics
>>>      [echo] ###############################################
>>>      [echo]
>>>      [echo] if        metaDiagnostics(newModel): # built-in utility 
>>> method in X3D class
>>>      [echo]     print(metaDiagnostics(newModel))
>>>      [echo] print('check  newModel.XML() serialization...')
>>>      [echo] newModelXML = newModel.XML() # test export method XML() 
>>> for exceptions
>>>      [echo] # print(newModelXML) # debug
>>>      [echo]
>>>      [echo] print ("python x3d.py load successful for HelloWorld.py")
>>>      [echo] ===========================================
>>>      [echo] Loading local x3d.py package in python to check for 
>>> correctness...
>>>      [echo]   then test HelloWorld.py execution and self-validation:
>>>      [echo]   python examples/HelloWorld.py
>>>      [exec] Traceback (most recent call last):
>>>      [exec]   File "examples/HelloWorld.py", line 21, in <module>
>>>      [exec]     from x3d import *
>>>      [exec] ImportError: No module named x3d
>>>      [exec] Result: 1
>>>      [echo] convert.X3dToPython.xslt conversion of HelloWorld.x3d to 
>>> HelloWorld.py complete.
>>>      [echo] ===========================================
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> set.local.PYTHONPATH:
>>>      [echo] local.PYTHONPATH=x3d
>>>
>>> examples.SmokeTests:
>>>      [echo] Run PythonX3dSmokeTests.py in python using local build 
>>> of Python x3d package
>>>      [echo]   python examples/PythonX3dSmokeTests.py
>>>      [exec]   File "examples/PythonX3dSmokeTests.py", line 50
>>>      [exec]     print ('SFBool     isValidSFBool(test)=' + 
>>> str(isValidSFBool(test)), flush=True)
>>> [exec] ^
>>>      [exec] SyntaxError: invalid syntax
>>>      [exec] Result: 1
>>>      [echo] test.X3dToPython.SmokeTests complete.
>>>      [echo] ===========================================
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> examples.BackgroundCollection:
>>>   [taskdef] Could not load definitions from resource 
>>> net/sf/antcontrib/antcontrib.properties. It could not be found.
>>>
>>> set.local.PYTHONPATH:
>>>      [echo] local.PYTHONPATH=x3d
>>>
>>> convert.X3dToPython.xslt:
>>>      [echo] ===========================================
>>>    [delete] Deleting 
>>> /c/x3d-code/www.web3d.org/x3d/stylesheets/python/examples/BackgroundCollection.py
>>>      [echo] ===========================================
>>>      [echo] convert.X3dToPython.xslt conversion of 
>>> BackgroundCollection.x3d to BackgroundCollection.py complete.
>>>      [echo] ###############################################
>>>      [echo] #
>>>      [echo] # Now available: developmental python x3d.py package on 
>>> PyPi for import.
>>>      [echo] #   This approach greatly simplifies Python X3D 
>>> deployment and use.
>>>      [echo] #   https://pypi.org/project/x3d
>>>      [echo] #
>>>      [echo] # Installation:
>>>      [echo] #       pip install x3d
>>>      [echo] # or
>>>      [echo] #       python -m pip install x3d
>>>      [echo] #
>>>      [echo] # Developer options for loading x3d package:
>>>      [echo] #
>>>      [echo] #    from x3d import *  # preferred approach, terser 
>>> source that avoids x3d.* class prefixes
>>>      [echo] #
>>>      [echo] # or
>>>      [echo] #    import x3d         # traditional way to subclass 
>>> x3d package, all classes require x3d.* prefix
>>>      [echo] #                       # but python source is very 
>>> verbose, for example x3d.Material x3d.Shape etc.
>>>      [echo] #                       # X3dToPython.xslt stylesheet 
>>> insertPackagePrefix=true supports this option.
>>>      [echo]
>>>      [echo] from x3d import *
>>>      [echo]
>>>      [echo] ###############################################
>>>      [echo]
>>>      [echo] newModel=X3D(profile='Interchange',version='3.3',
>>>      [echo]   head=head(
>>>      [echo]     children=[
>>>      [echo] meta(content='BackgroundCollection.x3d',name='title'),
>>>      [echo]     meta(content='Collection of example Background nodes 
>>> for author reuse, browse by selecting corresponding 
>>> viewpoints.',name='description'),
>>>      [echo]     meta(content='28 December 2014',name='created'),
>>>      [echo]     meta(content='20 October 2019',name='modified'),
>>>      [echo]     meta(content='Don Brutzman',name='creator'),
>>>      [echo] 
>>> meta(content='https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaPanoramas',name='reference'),
>>>      [echo] 
>>> meta(content='https://www.web3d.org/x3d/tooltips/X3dTooltips.html#Background',name='reference'),
>>>      [echo] 
>>> meta(content='https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/enveffects.html#Background',name='reference'),
>>>      [echo] 
>>> meta(content='https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/enveffects.html#Concepts',name='reference'),
>>>      [echo] 
>>> meta(content='https://x3dgraphics.com/slidesets/X3dForWebAuthors/Chapter11-LightingEnvironment.pdf',name='reference'),
>>>      [echo] 
>>> meta(content='https://x3dgraphics.com/examples/X3dForAdvancedModeling/Visualization/BackgroundCollection.x3d',name='identifier'),
>>>      [echo] 
>>> meta(content='https://www.web3d.org/x3d/content/examples/license.html',name='license'),
>>>      [echo]     meta(content='X3D-Edit 3.3, 
>>> https://savage.nps.edu/X3D-Edit',name='generator')]),
>>>      [echo]   Scene=Scene(
>>>      [echo]     children=[
>>>      [echo]     WorldInfo(title='BackgroundCollection.x3d'),
>>>      [echo]     Group(DEF='AllLandBackgrounds',
>>>      [echo]       children=[
>>>      [echo] 
>>> Background(DEF='BlueSkyWhiteHorizonBrownLand',groundAngle=[1.309,1.5708],groundColor=[(0.5,0.3,0.3),(0.5,0.3,0.3),(0.5,0.4,0.4)],skyAngle=[1.309,1.572],skyColor=[(0,0.2,0.7),(0,0.5,1),(1,1,1)]),
>>>      [echo] 
>>> Viewpoint(DEF='BlueSkyWhiteHorizonBrownLandViewpoint',description='Blue 
>>> Sky White Horizon Brown Land'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='BlueSkyWhiteHorizonBrownLandViewpoint',toField='set_bind',toNode='BlueSkyWhiteHorizonBrownLand')]),
>>>      [echo]     Group(DEF='AllSeaBackgrounds',
>>>      [echo]       children=[
>>>      [echo] 
>>> Background(DEF='BlueOceanWhiteHorizon',groundAngle=[1.309,1.570796],groundColor=[(0,0.3,.7),(0,0.35,0.75),(0,0.4,0.8)],skyAngle=[1.309,1.571],skyColor=[(0,0.3,0.8),(0,0.5,1),(1,1,1)]),
>>>      [echo] 
>>> Viewpoint(DEF='BlueOceanWhiteHorizonViewpoint',description='Blue 
>>> Ocean White Horizon'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='BlueOceanWhiteHorizonViewpoint',toField='set_bind',toNode='BlueOceanWhiteHorizon'),
>>>      [echo] 
>>> Background(DEF='OvercastSkyBlueOcean',groundAngle=[0.1,1.5,1.56,1.570796],groundColor=[(0,0,0),(0,0.1,0.2),(0,0.1,0.2),(0,0.15,0.3),(0.1,0.1,0.1)],skyAngle=[0.1,1.4,1.5,1.565,1.57079],skyColor=[(0.1,0.1,0.1),(0.2,0.2,0.2),(0.2,0.2,0.2),(0,0.3804,0.4784),(0,0.2,0.4),(0.4,0.4,0.4)]),
>>>      [echo] 
>>> Viewpoint(DEF='OvercastSkyBlueOceanViewpoint',description='Overcast 
>>> Sky Blue Ocean'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='OvercastSkyBlueOceanViewpoint',toField='set_bind',toNode='OvercastSkyBlueOcean'),
>>>      [echo] 
>>> Background(DEF='BlueSkyBlueOcean',groundAngle=[1.57079],groundColor=[(0,0.15,0.25),(0,0.15,0.25)],skyColor=[(0,0.3,0.5)]),
>>>      [echo] 
>>> Viewpoint(DEF='BlueSkyBlueOceanViewpoint',description='Blue Sky Blue 
>>> Ocean'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='BlueSkyBlueOceanViewpoint',toField='set_bind',toNode='BlueSkyBlueOcean')]),
>>>      [echo]     Group(DEF='AllSkyBackgrounds',
>>>      [echo]       children=[
>>>      [echo] Background(DEF='SimplyWhite',skyColor=[(1,1,1)]),
>>>      [echo] Viewpoint(DEF='SimplyWhiteViewpoint',description='Simply 
>>> White'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='SimplyWhiteViewpoint',toField='set_bind',toNode='SimplyWhite'),
>>>      [echo] Background(DEF='SimplyGrey',skyColor=[(0.8,0.8,0.8)]),
>>>      [echo] Viewpoint(DEF='SimplyGreyViewpoint',description='Simply 
>>> Grey'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='SimplyGreyViewpoint',toField='set_bind',toNode='SimplyGrey'),
>>>      [echo] Background(DEF='SimplyDarkGrey',skyColor=[(0.4,0.4,0.4)]),
>>>      [echo] 
>>> Viewpoint(DEF='SimplyDarkGreyViewpoint',description='Simply Dark 
>>> Grey'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='SimplyDarkGreyViewpoint',toField='set_bind',toNode='SimplyDarkGrey'),
>>>      [echo]       Background(DEF='SimplyBlack'),
>>>      [echo] Viewpoint(DEF='SimplyBlackViewpoint',description='Simply 
>>> Black'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='SimplyBlackViewpoint',toField='set_bind',toNode='SimplyBlack')]),
>>>      [echo]     Group(DEF='AllVarietyBackgrounds',
>>>      [echo]       children=[
>>>      [echo] 
>>> Background(DEF='BackgroundTest1',groundAngle=[1,1.4,1.5],groundColor=[(0,0,0),(0.2157,1,0.1216),(0.5,0.5,0.5),(1,1,1)],skyAngle=[1,1.309,1.57079],skyColor=[(0,0,0),(0.1647,0.0588,1),(0.5,0.5,0.5),(1,1,1)]),
>>>      [echo] 
>>> Background(DEF='BackgroundTest2',groundAngle=[1,1.309],groundColor=[(0,0.3,.7),(0,0.35,0.75),(0,0.4,0.8)],skyAngle=[1.309,1.57079],skyColor=[(0,0.3,0.8),(0,0.5,1),(1,1,1)]),
>>>      [echo] 
>>> Background(DEF='BackgroundTest3',groundAngle=[1.57079],groundColor=[(0,0.15,0.25),(0,0.15,0.25)],skyColor=[(0,0.3,0.5)]),
>>>      [echo] 
>>> Background(DEF='BackgroundTest4',groundAngle=[1.57079],groundColor=[(0,0.15,0.25),(0,0.15,0.25)],skyColor=[(0,0.3,0.5)]),
>>>      [echo] Viewpoint(DEF='ViewpointTest1',description='Test1'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='ViewpointTest1',toField='set_bind',toNode='BackgroundTest1'),
>>>      [echo] Viewpoint(DEF='ViewpointTest2',description='Test2'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='ViewpointTest2',toField='set_bind',toNode='BackgroundTest2'),
>>>      [echo] Viewpoint(DEF='ViewpointTest3',description='Test3'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='ViewpointTest3',toField='set_bind',toNode='BackgroundTest3'),
>>>      [echo] Viewpoint(DEF='ViewpointTest4',description='Test4'),
>>>      [echo] 
>>> ROUTE(fromField='isBound',fromNode='ViewpointTest4',toField='set_bind',toNode='BackgroundTest4')]),
>>>      [echo]     Group(DEF='UnboundViewpoints',
>>>      [echo]       #  The final two viewpoints are not separately 
>>> bound and can be selected to check any of the other Background nodes
>>>      [echo]       children=[
>>>      [echo]       Viewpoint(description='Looking up at current 
>>> Background zenith',orientation=(1,0,0,1.570796)),
>>>      [echo]       Viewpoint(description='Looking down at current 
>>> Background nadir',orientation=(1,0,0,-1.570796))])])
>>>      [echo] ) # X3D model complete
>>>      [echo]
>>>      [echo] ###############################################
>>>      [echo] # Self-test diagnostics
>>>      [echo] ###############################################
>>>      [echo]
>>>      [echo] if        metaDiagnostics(newModel): # built-in utility 
>>> method in X3D class
>>>      [echo]     print(metaDiagnostics(newModel))
>>>      [echo] print('check  newModel.XML() serialization...')
>>>      [echo] newModelXML = newModel.XML() # test export method XML() 
>>> for exceptions
>>>      [echo] # print(newModelXML) # debug
>>>      [echo]
>>>      [echo] print ("python x3d.py load successful for 
>>> BackgroundCollection.py")
>>>      [echo] ===========================================
>>>      [echo] Loading local x3d.py package in python to check for 
>>> correctness...
>>>      [echo]   then test BackgroundCollection.py execution and 
>>> self-validation:
>>>      [echo]   python examples/BackgroundCollection.py
>>>      [exec] Traceback (most recent call last):
>>>      [exec]   File "examples/BackgroundCollection.py", line 21, in 
>>> <module>
>>>      [exec]     from x3d import *
>>>      [exec] ImportError: No module named x3d
>>>      [exec] Result: 1
>>>      [echo] convert.X3dToPython.xslt conversion of 
>>> BackgroundCollection.x3d to BackgroundCollection.py complete.
>>>      [echo] ===========================================
>>>
>>> BUILD SUCCESSFUL
>>> Total time: 5 seconds
>>>



More information about the x3d-public mailing list