Cancel
Showing results for 
Search instead for 
Did you mean: 

PYTHONPATH defined in windows environment variable interferes with NX CAM simulation

Hi All,

 

I have PYTHONPATH variable defined in my system environment variables of Windows 10 machine.

It refers to a standalone python2.5 available on my machine. 

It is required for some other application on my machine.

 

While running NX12 CAM simulation application, I started getting errors related to python dependancies.

 

If I remove the PYTHONPATH environent variable NX CAM simulation works fine.

I was under the impression that NX applications refere to UGII_PYTHONPATH  , but looks like that is not the case.

 

I can not remove the PYTHONPATH enviroment variable from my system, Is there any workaaround to resolve this issue.

 

Thanks,

Ramesh

 

 

 

4 REPLIES 4

Re: PYTHONPATH defined in windows environment variable interferes with NX CAM simulation

Siemens Phenom Siemens Phenom
Siemens Phenom

It is true that NXOpen Python is using UGII_PYTHONPATH in internal NX for historical reasons.

PYTHONPATH was already used by other NX applications like NX Human before NXOpen Python was introduced in NX10 and the Python version was not compatible yet.

 

# NX 10.0\UGII\ugii_env_ug.dat

UGII_PYTHON_HOME=${UGII_BASE_DIR}\ugii\python
UGII_PYTHONPATH=${UGII_PYTHON_HOME};${UGII_PYTHON_HOME}\Python33.zip

JK_KIT=${UGII_BASE_DIR}\nxhuman\jack_toolkit
PYTHONPATH=${JK_KIT}\lib\python2.6;${JK_KIT}\library\script;${JK_KIT}\lib

In NX12 the Pyhon versions got "synchronized" and PYTHONPATH changed to include UGII_PYTHONPATH.

 

# NX 12.0\UGII\ugii_env_ug.dat

UGII_PYTHON_HOME=${UGII_BASE_DIR}\nxbin\python
UGII_PYTHONPATH=${UGII_PYTHON_HOME};${UGII_PYTHON_HOME}\Python36.zip

JK_KIT=${UGII_BASE_DIR}\nxhuman\jack_toolkit
PYTHONPATH=${UGII_PYTHONPATH};${JK_KIT}\lib;${JK_KIT}\library\script

 

NX1847 finally dropped the NXHUMAN\jack_toolkit\lib\python## folder.

 

If you need PYTHONPATH pointing to an older Python distribution for other applications - why don't you just start NX from a simple batch script to overwrite the system defined variable value and start ugraf.exe?

Re: PYTHONPATH defined in windows environment variable interferes with NX CAM simulation

Thank you for the resonse and detailed information.

 

I modified the issue statement before posting here, just for simplicity.

 

The real issue is, the custom batch file used for launching NX has the PYTHONPATH pointing to an older Python distribution, which is refrerred by a custom python application which interacts with NX. 

So I can not remove the PYTHONPATH from the batch file which launches NX.

 

I was hoping NX would override the PYTHONPATH through ugii_env_ug.dat file, but that does not seem to happen.

 

Thanks,

Ramesh

 

Re: PYTHONPATH defined in windows environment variable interferes with NX CAM simulation

Siemens Phenom Siemens Phenom
Siemens Phenom

@Ramesh_Sawant wrote:

I was hoping NX would override the PYTHONPATH through ugii_env_ug.dat file, but that does not seem to happen.

It's the other way - if NX finds an environment variable (defined in control panel or batch) then the corresponding values in ugii_env_ug.dat / ugii_env.dat are not taken into account.

This way allows to run multiple scenarios quickly without touching the original configuration files.


But it doesn't matter here which location overwrites the other because you cannot manage 2 different environment variable values in the same session and your external application should comply with NX to prevent possible .pyd library conflicts depending on the sequence they are found and loaded.

 

Re: PYTHONPATH defined in windows environment variable interferes with NX CAM simulation

Thank you for the response. I appreciate it.