[x3d-public] need help with import

John Carlson yottzumm at gmail.com
Tue Apr 23 13:27:53 PDT 2019


Note, I only create one symbol per file currently, so no problem with namespace confusion, I hope.

Sent from Mail for Windows 10

From: John Carlson
Sent: Tuesday, April 23, 2019 3:16 PM
To: Peitso, Loren (CIV); Brutzman, Donald (Don) (CIV)
Cc: X3D Graphics public mailing list
Subject: RE: need help with import

Could I do:

import org.web3d.x3d.jsail.Core.X3DObject.X3DObject as X3D

???

Sent from Mail for Windows 10

From: Peitso, Loren (CIV)
Sent: Tuesday, April 23, 2019 11:23 AM
To: John Carlson; Brutzman, Donald (Don) (CIV)
Cc: X3D Graphics public mailing list
Subject: Re: need help with import

You want 

import classpath
import org.web3d.x3d.jsail.Core.X3DObject as X3D               

X3D0 = X3D.X3D() /



The module error was due to not having the module name prepended to the constructor call, which is the required tradeoff for avoiding the namespace messes of from inporting.   It is the from style importing that creates potential silent namespace overwrite problems.  

I hope this helps. Apologies on the terseness, I'm down with a bug.

v/r  Loren




From: John Carlson <yottzumm at gmail.com>
Sent: Tuesday, April 23, 2019 12:08:09 AM
To: Brutzman, Donald (Don) (CIV); Peitso, Loren (CIV)
Cc: X3D Graphics public mailing list
Subject: RE: need help with import 
 
I think that Loren suggested import * clouded the namespace too much (did we get the same email?).
 
We could do
 
import X3Dautoclass
 
John  
 
Sent from Mail for Windows 10
 
From: Brutzman, Donald (Don) (CIV)
Sent: Tuesday, April 23, 2019 12:53 AM
To: John Carlson; Peitso, Loren (CIV)
Cc: X3D Graphics public mailing list
Subject: Re: need help with import
 
Yes this is a Loren question.
 
>From prior email conversation and guidance from Loren, I think a good .py file starts with
 
from X3Dautoclass import *
X3D0 = X3D() \
    .setProfile("Immersive") \
    .setVersion("3.3") \
    # [etc.]
 
 
 
On 4/22/2019 10:15 PM, John Carlson wrote:
> import classpath
> 
> import org.web3d.x3d.jsail.Core.X3DObject as X3D
> 
> The above doesn’t work. Message:
> 
> $ python abox.future.py
> 
> Traceback (most recent call last):
> 
>    File "abox.future.py", line 20, in <module>
> 
>      X3D0 = X3D() \
> 
> TypeError: 'module' object is not callable
> 
> $ cat org/web3d/x3d/jsail/Core/X3DObject.py
> 
> from jnius import autoclass
> 
> X3DObject = autoclass('org.web3d.x3d.jsail.Core.X3DObject')
> 
> Suggestions?
> 
> Thanks,
> 
> John
> 
 
 
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 http://faculty.nps.edu/brutzman
 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190423/2ae9dcdf/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: F85A8FD195EF4BCE94B2236B20B5A947.png
Type: image/png
Size: 144 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190423/2ae9dcdf/attachment-0001.png>


More information about the x3d-public mailing list