Trying to use command line but getting a .dll error.
4515
4
1
hou_person
Member
15 posts
Joined: Aug. 2017
Offline
Aug. 17, 2017 8:24 p.m.
I'm trying to access the hou module for command line (windows) Regular Python Shell (python 2.7)
The sideFX doc [
www.sidefx.com ] But when I append my env variable ('C:\Program Files\Side Effects Software\Houdini 16.0.671\houdini\python2.7libs') and append it also to my sys path in the python shell I get a:
File "C:\Program Files\Side Effects Software\Houdini 16.0.671\houdini\python2.7libs\hou.py" , line 19 , in < module >
import _hou
ImportError : DLL load failed : The specified module could not be found .
In my libs folder I don't have a ‘_hou.py’ I only have ‘_hou.pyd’
After trying to figure it out myself I am unable to get this working, anyone have a suggestion for me?
Edited by hou_person - Aug. 17, 2017 20:25:12
hou_person
Member
15 posts
Joined: Aug. 2017
Offline
Aug. 23, 2017 1 p.m.
Hey guys, hate to be that guy but only 30 people viewed it, and I am still lost. One bump for good luck.
NFX
Member
183 posts
Joined: Dec. 2011
Offline
March 22, 2018 6:28 p.m.
Having this issue with H16 on windows. Tried using the dlopen_flags from the documentation and still no luck. Anyone figure this out?
March 26, 2019 1:41 a.m.
I'm trying to do this as well in Houdini 17.5/Windows 10 and i'm getting the same error.
Here's a workaround which will find hython and re-run the script there:
import os, sys def _locate_houdini(): import os from _winreg import ConnectRegistry, OpenKey, CloseKey, EnumKey, EnumValue, QueryValue, HKEY_LOCAL_MACHINE install_path = None abort = False while install_path is None and not abort: try: registry = ConnectRegistry(None, HKEY_LOCAL_MACHINE) key_path = 'SOFTWARE\\Side Effects Software\\' key = OpenKey(registry, key_path) i = 0 while install_path is None: sub_key = EnumKey(key, i) i += 1 if sub_key == 'Houdini' or sub_key == 'Houdini Engine': sub_key = OpenKey(key, sub_key) install_path = EnumValue(sub_key, 0)[1] if not os.path.exists(install_path): install_path = None CloseKey(sub_key) CloseKey(key) except: pass return install_path def _locate_hython(): houdini_path = _locate_houdini() hython_path = houdini_path + 'bin\\hython2.7.exe' assert os.path.exists(hython_path), 'hython not found!' return hython_path def _bootstrap(argv): import subprocess hython_path = _locate_hython() subprocess.call([hython_path, __file__] + argv) # We're running in hython def execute(argv): import hou print 'hello in hython' print argv def main(argv): try: import hou execute(argv) except: _bootstrap(argv) if __name__ == '__main__': main(sys.argv[1:])
Edited by George Rolfe - March 26, 2019 01:59:28
dpotuznik
Member
11 posts
Joined: April 2019
Offline
Aug. 9, 2021 11:45 a.m.
George Rolfe import os, sys def _locate_houdini(): import os from _winreg import ConnectRegistry, OpenKey, CloseKey, EnumKey, EnumValue, QueryValue, HKEY_LOCAL_MACHINE install_path = None abort = False while install_path is None and not abort: try: registry = ConnectRegistry(None, HKEY_LOCAL_MACHINE) key_path = 'SOFTWARE\\Side Effects Software\\' key = OpenKey(registry, key_path) i = 0 while install_path is None: sub_key = EnumKey(key, i) i += 1 if sub_key == 'Houdini' or sub_key == 'Houdini Engine': sub_key = OpenKey(key, sub_key) install_path = EnumValue(sub_key, 0) if not os.path.exists(install_path): install_path = None CloseKey(sub_key) CloseKey(key) except: pass return install_path def _locate_hython(): houdini_path = _locate_houdini() hython_path = houdini_path + 'bin\\hython2.7.exe' assert os.path.exists(hython_path), 'hython not found!' return hython_path def _bootstrap(argv): import subprocess hython_path = _locate_hython() subprocess.call( + argv) # We're running in hython def execute(argv): import hou print 'hello in hython' print argv def main(argv): try: import hou execute(argv) except: _bootstrap(argv) if __name__ == '__main__': main(sys.argv)Thank you for that