hou.isUIAvailable() not working in pythonrc.py

   2505   4   0
User Avatar
Member
12 posts
Joined: June 2016
Offline
There's a line in our pythonrc.py file that checks if it's a UI session or not. Basically:

import hou
if (hou.isUIAvailable()):
    foo.bar()

For most computers this works fine. For some though, it gives the following error:

AttributeError: 'module' object has no attribute 'isUIAvailabe'

I can't figure out what could be causing this, or even what to do to diagnose it. Other calls to the ‘hou’ module like ‘hou.isApprentice()’ work fine.

Has anyone run into this problem or have a work around?

Thanks!
User Avatar
Member
106 posts
Joined: June 2011
Offline
That's really odd. Could you try to print and see where hou is loaded from ?

try:
    import hou
    print(hou.__file__)
    print(hasattr(hou, 'isUIAvailable'))
except ImportError:
    print("Failed to import hou") 
User Avatar
Member
12 posts
Joined: June 2016
Offline
jjayakumar
That's really odd. Could you try to print and see where hou is loaded from ?

try:
    import hou
    print(hou.__file__)
    print(hasattr(hou, 'isUIAvailable'))
except ImportError:
    print("Failed to import hou") 

Thanks for the response! Sorry for the late reply, I haven't had access to the affected machine in a while.

It gets more strange… Your code returns this:
C:/PROGRA~1/SIDEEF~1/HOUDIN~1.439/houdini/python2.7libs\hou.pyc
True

So it seems to know the module exists that way, but still fails with something as simple as:
try:
    import hou
    print(hou.isUIAvaliable())
except:
    print("Failed!")

I'm trying some things now. May have to find some sort of work around. It could also just be a problem with the current version we're on (16.5.439). I'll post back here if I find out anything.
User Avatar
Member
1925 posts
Joined: Nov. 2006
Offline
It looks like you've got a few spelling errors in the code being run which would give the observed AttributeError exceptions:

Correct:

isUIAvailable

Incorrect:

isUIAvaliable
isUIAvailabe
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
12 posts
Joined: June 2016
Offline
Ha! Embarrassing… I bet I wrote it wrong once or twice when I was debugging. Thanks for looking into it grahm and jjayakumar.
  • Quick Links