Shobhit Khinvasara
shobhitk
About Me
Connect
LOCATION
Not Specified
WEBSITE
Houdini Skills
Availability
Not Specified
Recent Forum Posts
Running Python 3 scripts in Houdini as a Subprocess Nov. 18, 2019, 10:36 p.m.
Hi,
I am trying to run my code in Python 3 from within Houdini using the subprocess module. The script is using PySide2.
Here is my simplified sample script:
I have tried various combinations of environments and also attempted to run this with a QRunnable and every time I have attempted it, I get some variation of this error:
Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named ‘encodings’
OR
CodecRegistryError.
Let me know if anyone has any insights on this.
Thanks
I am trying to run my code in Python 3 from within Houdini using the subprocess module. The script is using PySide2.
Here is my simplified sample script:
import subprocess import sys import os pythonhome = 'C:/python36/' env = os.environ env['PYTHONPATH'] = 'C:\\Python36' env['PYTHONHOME'] = 'C:\\Python36\\bin' env['PATH'] = env['PATH'].replace('C:/PROGRA~1/SIDEEF~1/HOUDIN~1.258/python27;', '') print(env['PATH']) testProc = subprocess.Popen([pythonhome + 'python.exe', r'C:\path\to\python\script.py'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env, shell=True) while True: line = testProc.stdout.readline() print(line) if not line: break
I have tried various combinations of environments and also attempted to run this with a QRunnable and every time I have attempted it, I get some variation of this error:
Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named ‘encodings’
OR
CodecRegistryError.
Let me know if anyone has any insights on this.
Thanks