import hou

   14287   9   3
User Avatar
Member
224 posts
Joined: 6月 2009
Offline
IHi all,

I am having problems importing hou from a Regular Python Shell. I am using latest versions of Python25, PyDev, Eclipse and Houdini. I have set the system PATH and PYTHONPATH as suggested in the docs, but I get this message when I ‘import hou’:

Traceback (most recent call last):
File “D:\Documents\Eclipse\z_Houdini_test2\test3.py”, line 18, in <module>
import hou
File “CPROGRA~1/SIDEEF~1/HOUDIN~1.295/houdini/scripts/python\hou.py”, line 17, in <module>
import _hou
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

When I change the Python interpreter from the standard Python25 to the one in Houdini, then it seems to work fine.

Any ideas why this is happening? I found some people having similar issues a while back, but there was no solution. Just wondering if this had now been resolved?

cheers
Patrick
Patrick
User Avatar
Member
7720 posts
Joined: 7月 2005
Offline
The compiler that is used by Houdini has to match the compiler that is used to build python.
User Avatar
Member
224 posts
Joined: 6月 2009
Offline
Hi Edward,

Thanks - that explains that problem.

So both $HFS/python/bin/python.exe and $HFS/bin/hython.exe are compiled with the right compiler. Both of these give no errors when I import hou.

Now onto the next issue - I want to run this code:
import hou
print hou.node('/obj').createNode('geo')

When I run this using Houdini's hython.exe, it seems to work fine. But when I run it using Houdini's python.exe, I get this message:

cpp error: “CPROGRA~1/SIDEEF~1/HOUDIN~1.295/houdini/soho/parameters/RIB3Delight8.5.ds”:5 Unable to include “CPROGRA~1/SIDEEF~1/HOUDIN~1.295/python/houdini/soho/parameters/CommonMacros.ds”

cpp error: “CPROGRA~1/SIDEEF~1/HOUDIN~1.295/houdini/soho/parameters/RIB3Delight8.5.ds”:72 Unable to include “CPROGRA~1/SIDEEF~1/HOUDIN~1.295/python/houdini/soho/parameters/CommonControl.ds”

cpp error: “CPROGRA~1/SIDEEF~1/HOUDIN~1.295/houdini/soho/parameters/RIB3Delight8.5.ds”:73 Unable to include “CPROGRA~1/SIDEEF~1/HOUDIN~1.295/python/houdini/soho/parameters/CommonView.ds”

cpp error: “CPROGRA~1/SIDEEF~1/HOUDIN~1.295/houdini/soho/parameters/RIB3Delight8.5.ds”:74 Unable to include “CPROGRA~1/SIDEEF~1/HOUDIN~1.295/python/houdini/soho/parameters/CommonObject.ds”

cpp error: “CPROGRA~1/SIDEEF~1/HOUDIN~1.295/houdini/soho/parameters/RIB3Delight8.5.ds”:75 Unable to include “CPROGRA~1/SIDEEF~1/HOUDIN~1.295/python/houdini/soho/parameters/Instance.ds”

geo1

Obviously, houdini.exe is doing something that python.exe is not, but I am not sure what. Any suggestions?

cheers
patrick
Patrick
User Avatar
Member
224 posts
Joined: 6月 2009
Offline
I came back to this problem recently - and I am still having the same problem. (I am using windows). If I start /python/bin/python2.5.exe, and do:

>>> import sys, os
>>> sys.path.append(os.environ+“/houdini/scripts/python”)
>>> import hou

At first it looks like it works. But then anything I do after that gives an invalid syntax error.

>>> hou
File “<stdin>”, line 1
hou
^
SyntaxError: invalid syntax


Is this a bug on windows?
Patrick
User Avatar
Member
7720 posts
Joined: 7月 2005
Offline
This has been fixed for the next major release of Houdini. The current workarounds are:
- Use hython
- Or, avoid using python interactively.
User Avatar
Member
88 posts
Joined: 3月 2010
Offline
Hi

“ImportError: DLL load failed: %1 is not a valid Win32 application.”

Is this error related to issue that is mentioned here? I have been trying to use interactive python session

thanks
User Avatar
Member
7720 posts
Joined: 7月 2005
Offline
Your error seems to be similar to the first post of this thread. Using an interactive python to import hou will not currently work regardless.
User Avatar
Member
617 posts
Joined: 8月 2008
Offline
i downloaded houdini apprentice 12.5 64bits with vc9
and i am trying to make a small script outside houdini
i got the python versión from here.
http://www.python.org/download/releases/2.6.8/ [python.org]

but not sure what the vc9 suppost to be .
do i need to download another versión of python?

thanks guys.
User Avatar
Member
193 posts
Joined: 12月 2016
Offline
Hello I`m here to report I`ve tried some the internet solutions and none of them seem to work.
Anny advice is welcome.

Im on Linux with vscode. Below are some of my settings.



( i also have the problem that the tmp.py files aren`t actually linked)

    "python.autoComplete.extraPaths": ["/opt/hfs19.5/python/lib"],
    "python.autoComplete.preloadModules": ["hou"],
    "terminal.integrated.env.linux": {
        "PYTHONPATH" : "/opt/hfs19.5/houdini/python/lib"},
    "python.analysis.extraPaths": [
        "/opt/hfs19.5/python/lib"
    ],
Edited by NicTanghe - 2023年9月5日 03:58:28
User Avatar
Member
106 posts
Joined: 6月 2011
Offline
NicTanghe
Hello I`m here to report I`ve tried some the internet solutions and none of them seem to work.
Anny advice is welcome.

Im on Linux with vscode. Below are some of my settings.



( i also have the problem that the tmp.py files aren`t actually linked)

    "python.autoComplete.extraPaths": ["/opt/hfs19.5/python/lib"],
    "python.autoComplete.preloadModules": ["hou"],
    "terminal.integrated.env.linux": {
        "PYTHONPATH" : "/opt/hfs19.5/houdini/python/lib"},
    "python.analysis.extraPaths": [
        "/opt/hfs19.5/python/lib"
    ],


Hi Nic,

It should be pointing to python3.9 libs instead. Try this

    "python.autoComplete.extraPaths": ["/opt/hfs19.5/houdini/python3.9libs"],
    "python.autoComplete.preloadModules": ["hou"],
    "terminal.integrated.env.linux": {
        "PYTHONPATH" : "/opt/hfs19.5/houdini/python3.9libs"},
    "python.analysis.extraPaths": [
        "/opt/hfs19.5/houdini/python3.9libs"
    ],


-J
  • Quick Links