[x3d-public] X3D Python binding X3DPSAIL progress: pyJNIus problem isolated

John Carlson yottzumm at gmail.com
Sat May 18 06:34:57 PDT 2019

Linking pyjnius failed. I guess we have to go to GitHub issues.   Or, do we have any Visual Studio users who can help build pyjnius?

Looks like some conflict between python 3 and python 2:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DEBUG:FULL /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Program Files\Java\jdk1.8.0_202\lib" "/LIBPATH:C:\Program Files\Java\jdk1.8.0_202\bin\server" /LIBPATH:C:\Users\coderextreme\AppData\Local\Programs\Python\Python37\libs /LIBPATH:C:\Users\coderextreme\AppData\Local\Programs\Python\Python37\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" jvm.lib /EXPORT:PyInit_jnius build\temp.win-amd64-3.7\Debug\jnius\jnius.obj /OUT:C:\Users\coderextreme\pyjnius\jnius\jnius.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Debug\jnius\jnius.cp37-win_amd64.lib
LINK : fatal error LNK1104: cannot open file 'python37_d.lib'
C:\Users\coderextreme\AppData\Local\Programs\Python\Python37\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\coderextreme\pyjnius\jnius\jnius.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\link.exe' failed with exit status 1104
make: *** [Makefile:20: build_ext] Error 1

Suggest getting a source release from pyjnius 1.2.0 (I think) found in anaconda.



Sent from Mail for Windows 10

From: John Carlson
Sent: Saturday, May 18, 2019 8:20 AM
To: Brutzman, Donald (Don) (CIV); X3D Graphics public mailing list
Subject: RE: X3D Python binding X3DPSAIL progress: pyJNIus problem isolated

Reflect.py is copied from the pyjnius source.  I recommend going to the pyjnius source under the kivy user on GitHub.  If you want to review the mapping between python and java, you’re welcome, but I don’t expect you to find anything interesting (but maybe there could be a bug there, I’ve not looked).

I’m one step ahead of you. Look at recent email where I suggest returning self instead of the return normal value of the JavaMethod.   I will repost.


Sent from Mail for Windows 10

From: Brutzman, Donald (Don) (CIV)
Sent: Saturday, May 18, 2019 8:14 AM
To: John Carlson; X3D Graphics public mailing list
Subject: X3D Python binding X3DPSAIL progress: pyJNIus problem isolated

1. Have committed several fixes and produced a new build of X3DJSAIL, uploaded updated python examples for X3D Example Archives.




- - -

2. Latest work refactored setDEF() and setUSE() methods.  There is no way to invoke them incorrectly.  Local use with a concrete node explicitly calls the protected superclass.

For example, in Java, the following pipelined methods always return the same updated ViewpointObject so that subsequent invocations are possible.

                new ViewpointObject().setDEF("ViewUpClose").setDescription("Hello world!").setCenterOfRotation(0.0f,-1.0f,0.0f).setPosition(0.0f,-1.0f,7.0f))

The nearly identical call in Python should work exactly the same, if pyjnius mappings are correct.  However it fails.  Invocation and Python log excerpt follow.

                Viewpoint().setDEF("ViewUpClose").setCenterOfRotation(0,-1,0).setDescription("Hello world!").setPosition(0,-1,7)

Loading HelloWorld.py (pipeline syntax) with python, if successful then saving and validating as HelloWorld_RoundTrip2.x3d version:
Traceback (most recent call last):
   File "C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForAdvancedModeling/HelloWorldScenes//HelloWorld.py", line 54, in <module>
     .addChild(Viewpoint().setDEF("ViewUpClose").setCenterOfRotation(0,-1,0).setDescription("Hello world!").setPosition(0,-1,7))
AttributeError: 'org.web3d.x3d.jsail.X3DConcreteNode' object has no attribute 'setCenterOfRotation'

The Python traceback above is misdirecting but close scrutiny nevertheless reveals the problem.  The .setCenterOfRotation() method should have been found on the pipelined ViewpointObject.  Instead, pyjnius is mistakenly looking at superclass org.web3d.x3d.jsail.X3DConcreteNode.  That shouldn't happen.

The first hundred or so of the remaining errors in the build log are all attributable to this same error.  This same explanation applies to the .addChild() issues you've looked at, John.

Having pushed the pyjnius error around, am positive that there is no way to work around it in X3DJSAIL.  Nor would we want to break a strict object-oriented design to accommodate a mistake in a secondary implementation.

So, not fixed yet, but appears to be fully isolated as a problem in our pyjnius mapping, or possibly pyjnius itself.

- - -

3. Specifically the error has to do with pyjnius preferentially looking for a superclass, rather than the object itself as specified, when returning a value from a method.

Recommend we next torment the X3D pyjnius binding you've created for further troubleshooting.

Once were fully confident about that, the problem is either (a) fixed, or (b) isolated to pyjnius itself.

So where do we go next, reflect.py?





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/20190518/a6aa7d5d/attachment.html>

More information about the x3d-public mailing list