Command-Line Python Scripting from Windows

   1347   2   2
User Avatar
Member
105 posts
Joined: July 2005
Offline
Greetings:

I am trying to execute a python script from a Windows10 command prompt. I don't know if this is a problem or not but I have Python Visual Studio installed on my machine.
I am running Houdini16.5.323 on an AMD64 driven laptop running Windows 10.

I am following the instructions given from http://www.sidefx.com/docs/houdini/hom/commandline.html [www.sidefx.com]
I appended “C:\Program Files\Side Effects Software\Houdini 16.5.323\bin\” to my Path variable
I created an HFS variable; C:\Program Files\Side Effects Software\Houdini 16.5.323\
I created a PYTHONPATH variable; C:\Program Files\Side Effects Software\Houdini 16.5.323\houdini\python2.7libs

When I try to run my script; C:\Python27\python.exe connectHoudini.py
I get the following error:
Traceback (most recent call last):
File “connectHoudini.py”, line 30, in <module>
enableHouModule()
File “connectHoudini.py”, line 25, in enableHouModule
import hou
File “C:\Program Files\Side Effects Software\Houdini 16.5.323\houdini\python2.7libs\hou.py”, line 19, in <module>
import _hou
ImportError: DLL load failed: The specified procedure could not be found.

Anyone have any ideas where I might be getting this DLL Load error?
I was able to get it working from my cygwin but not from windows command prompt.

This is the connectHoudini.py script:
def enableHouModule():
    import sys, os
    if hasattr(sys, "setdlopenflags"):
        old_dlopen_flags = sys.getdlopenflags()
        import DLFCN
        sys.setdlopenflags(old_dlopen_flags | DLFCN.RTLD_GLOBAL)

    try:
        import hou
    except ImportError:
        HFS = "C:\Program Files\Side Effects Software\Houdini 16.5.323"
        pythonVersion = "python2.7"
        libs = HFS + "\houdini\\" + pythonVersion + "libs"
        sys.path.append(libs)
        import hou
    finally:
        if hasattr(sys, "setdlopenflags"):
            sys.setdlopenflags(old_dlopen_flags)

enableHouModule()
import hou
User Avatar
Member
180 posts
Joined: Dec. 2011
Offline
I'm having this exact issue as well. I think the conflict is coming from my system's python. Perhaps there is a way to swap to using houdini's included python when the hou module is imported?
User Avatar
Member
45 posts
Joined: March 2011
Offline
Hi,

Any luck importing hou without dll errors?

I could do it in some machines, but in my brand new Dell AIO I can´t find a way getting python to import hou without errors.

/python2.7libs was added to pythonpath var.

/bin was added to the path var.
  • Quick Links