Abaqus is a physics based mechanical simulation tool. It comes bundled with python 2.7.3. I use python scripts to automate certain operations. Recently, I had to run a Python3.5 script through Abaqus CAE python interactive interface using os.system(). subprocess.call or subprocess.popen did not work either. Abaqus python kept giving the following error:
Fatal Python error: Py_Initialize: unable to load the file system codec File "C:\SIMULIA\CAE\2016\win_b64\tools\SMApy\python2.7\lib\encodings__init__.py", line 123 raise CodecRegistryError,\
People who got similar errors were able to debug their codes by correcting the path information. No matter what I tried abaqus python insists on initializing python3 using its own init.py file, which gives the syntax error. Below are some of the things I have tried:
- I defined PYTHONHOME and PYTHONPATH variables point to the v3.5 folder
- I appended v3.5 folders to the sys.path.
- I removed the folder of the conflicting init.py file from sys.path and appended v3.5 folders to sys.path
- I reset sys.path and appended v3.5 folders to the sys.path.
- I manually modified sys.prefix to point to v3.5 folder
- I created a DOS batch file which calls v3.5. I called this batch file from Abaqus. Same error.
Any ideas what is going on? I can successfully place an external call to python 3 from within a python 2 script outside of abaqus.