Cancel
Showing results for 
Search instead for 
Did you mean: 

Using NX with Python 3.5 or later

Genius
Genius

Has anyone gotten NX11 to work with Python 3.5 or later?  I've gone through the documentation but some of it appears to be wrong and I didn't find any joy going though the  forum posts (although @AlexLee made some good progress with python 3.3).

 

First of all, I've set all my environment variables as follows:  

UGII_PYTHON_DLL = python35.dll

UGII_PYTHON_HOME = D:\Python35

UGII_PYTHON_LIBRARY_DIR = D:\python35

UGII_PYTHONPATH =D:\Python35;D:\Python35\DLLs;D:\Python35\Lib;D:\Python35\Lib\site-packages;%UGII_BASE_DIR%\nxbin\python

 

The documentation  says UGII_PYTHON_LIBRARY_DIR should point to D:\python35\DLLs.  However, python35.dll is in D:\python35 so that didn't work.

 

Also, the documentation says my UGII_PYTHONPATH shoudl contain %UGII_BASE_DIR%\ugii\python but that isn't where the python files are (for NX11).

 

After setting everything up, I seem to be failing at initilizing python.

 

The reason D:\Program Files\Siemens\NX 11.0\NXBIN\libpythonutils.dll failed to load was:
Cannot load image D:\Program Files\Siemens\NX 11.0\NXBIN\libpythonutils.dll
The operation completed successfully.

 

 

 

3 REPLIES

Re: Using NX with Python 3.5 or later

Valued Contributor
Valued Contributor

Re: Using NX with Python 3.5 or later

Genius
Genius

The question is how to use a later version, not what version comes with NX11. 

 

Python 3.4 isn't supported by some of my libraries and the documentation seems to suggest there is a way to use other versions with NX.

Re: Using NX with Python 3.5 or later

Pioneer
Pioneer

There is supposed to be a way to configure enough settings that you can teach NX to use a different installation of Python that exists on your computer.  AFAIK, this is the only way to use external libraries like numpy.  But the drawback (once you get it to work) is that no-one else can use your code unless they also have the same installation of Python and the same configurations.  Because I'm writing automations to share with my department, I'm sticking to stock 3.3.2 (we are on NX10) and when we get to NX11 I'll stick to whatever that comes with.

 

It would be really useful for Siemens to start including more external modules with the Python that ships with NX, in additon to PLY.  I understand not including ALL of them, but why not numpy, openpyxl, and other commonly relied on packages?  The suggestion here to install something else doesn't work really well when you are writing for dozens of users.