[x3d-public] Python, the emperor has no clothes!

John Carlson yottzumm at gmail.com
Mon Apr 20 10:30:18 PDT 2020


Trying to get mybinder working with x3d.py:

https://mybinder.org/v2/gh/coderextreme/conda/master?filepath=BackgroundCollection.ipynb


It works locally on my Jupyter notebook. There's a problem with trying to
iterate on a NoneType. I imagine this is an x3d.py problem, similar to
treating an Appearance like a iterable.  Code works from command line, and
locally!

You can copy my repo and try to get it to work.  Thanks!

https://github.com/coderextreme/conda

or just rename BackgroundCollection.py to .ipynb.

John

On Mon, Apr 20, 2020 at 10:57 AM John Carlson <yottzumm at gmail.com> wrote:

> testing toXML in python.   BackgroundCollection.py works.
>
> These don't:
> $ python HelloWorld.py
> x3d.py package loaded, have fun with X3D Graphics!
> Traceback (most recent call last):
>   File "HelloWorld.py", line 77, in <module>
>     print (     newModel.toXML())
>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\examples\x3d.py",
> line 6878, in toXML
>     result += str(self.Scene.toXML(indentLevel=indentLevel+1))
>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\examples\x3d.py",
> line 6679, in toXML
>     result += each.toXML(indentLevel=indentLevel+1)
>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\examples\x3d.py",
> line 19183, in toXML
>     result += each.toXML(indentLevel=indentLevel+1)
>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\examples\x3d.py",
> line 40543, in toXML
>     result += each.toXML(indentLevel=indentLevel+1)
>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\examples\x3d.py",
> line 35796, in toXML
>     for each in self.appearance:
> TypeError: 'Appearance' object is not iterable
>
> coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/
> www.web3d.org/x3d/stylesheets/python/examples
> $ python HelloWorldPrefixed.py
> x3d.py package loaded, have fun with X3D Graphics!
> Traceback (most recent call last):
>   File "HelloWorldPrefixed.py", line 77, in <module>
>     print (     newModel.toXML())
>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\examples\x3d.py",
> line 6878, in toXML
>     result += str(self.Scene.toXML(indentLevel=indentLevel+1))
>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\examples\x3d.py",
> line 6679, in toXML
>     result += each.toXML(indentLevel=indentLevel+1)
>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\examples\x3d.py",
> line 19183, in toXML
>     result += each.toXML(indentLevel=indentLevel+1)
>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\examples\x3d.py",
> line 40543, in toXML
>     result += each.toXML(indentLevel=indentLevel+1)
>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\examples\x3d.py",
> line 35796, in toXML
>     for each in self.appearance:
> TypeError: 'Appearance' object is not iterable
>
> -----------------------
>
> Appearance is an SFNode, so it's not a iterable.
>
>
> On Mon, Apr 20, 2020 at 10:27 AM John Carlson <yottzumm at gmail.com> wrote:
>
>> You have both a x3d.py and x3d folder.  I don't think that's allowed, or
>> you need to put more symbols in __init__.py, perhaps?
>>
>> On Mon, Apr 20, 2020 at 10:23 AM John Carlson <yottzumm at gmail.com> wrote:
>>
>>> On the x3d.py page @ web3d:
>>>
>>> *Workaround*: if needed for development, simply download x3d.py
>>> <https://www.web3d.org/x3d/stylesheets/python/x3d.py> package source
>>> and place it in same directory as your python program.
>>>
>>> That works too!
>>>
>>> On Mon, Apr 20, 2020 at 10:21 AM John Carlson <yottzumm at gmail.com>
>>> wrote:
>>>
>>>> Okay!
>>>> from x3d import *
>>>> does not work
>>>>
>>>> import x3d
>>>> works.
>>>>
>>>> puzzling.
>>>>
>>>> John
>>>>
>>>> On Mon, Apr 20, 2020 at 10:14 AM John Carlson <yottzumm at gmail.com>
>>>> wrote:
>>>>
>>>>> I give up. I can't get a simple import to work!  I have python 3.8.2
>>>>> (latest).
>>>>>
>>>>> Hmm.
>>>>>
>>>>> On Mon, Apr 20, 2020 at 9:32 AM John Carlson <yottzumm at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/
>>>>>> www.web3d.org/x3d/stylesheets/python/examples
>>>>>> $ ls
>>>>>> BackgroundCollection.py   HelloWorld.py   HelloWorldPrefixed.py
>>>>>> README.md
>>>>>> BackgroundCollection.x3d  HelloWorld.x3d  PythonX3dSmokeTests.py
>>>>>>
>>>>>> coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/
>>>>>> www.web3d.org/x3d/stylesheets/python/examples
>>>>>> $ python HelloWorld.py
>>>>>> Traceback (most recent call last):
>>>>>>   File "HelloWorld.py", line 21, in <module>
>>>>>>     from x3d import *
>>>>>> AttributeError: module 'x3d' has no attribute 'SFBool'
>>>>>>
>>>>>> coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/
>>>>>> www.web3d.org/x3d/stylesheets/python/examples
>>>>>> $ python BackgroundCollection.py
>>>>>> Traceback (most recent call last):
>>>>>>   File "BackgroundCollection.py", line 21, in <module>
>>>>>>     from x3d import *
>>>>>> AttributeError: module 'x3d' has no attribute 'SFBool'
>>>>>>
>>>>>> coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/
>>>>>> www.web3d.org/x3d/stylesheets/python/examples
>>>>>> $ python HelloWorldPrefixed.py
>>>>>> Traceback (most recent call last):
>>>>>>   File "HelloWorldPrefixed.py", line 26, in <module>
>>>>>>     newModel=x3d.X3D(profile='Immersive',version='3.3',
>>>>>> AttributeError: module 'x3d' has no attribute 'X3D'
>>>>>>
>>>>>> coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/
>>>>>> www.web3d.org/x3d/stylesheets/python/examples
>>>>>> $ python PythonX3dSmokeTests.py
>>>>>> ===================
>>>>>> Importing local development copy of X3D package:
>>>>>>   from x3d import *
>>>>>> Traceback (most recent call last):
>>>>>>   File "PythonX3dSmokeTests.py", line 23, in <module>
>>>>>>     from x3d import *
>>>>>> AttributeError: module 'x3d' has no attribute 'SFBool'
>>>>>>
>>>>>> Umm.  It's a race to see who gets toXML first!
>>>>>>
>>>>>> John
>>>>>>
>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200420/7bf1ec27/attachment-0001.html>


More information about the x3d-public mailing list