hou.isUIAvailable() not working in pythonrc.py
2505
4
0
July 15, 2019 1:37 p.m.
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!
jjayakumar
Member
106 posts
Joined: June 2011
Offline
July 16, 2019 6:17 a.m.
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" )
July 31, 2019 6:10 p.m.
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.
graham
Member
1925 posts
Joined: Nov. 2006
Offline
July 31, 2019 6:43 p.m.
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
Aug. 2, 2019 12:15 p.m.
Ha! Embarrassing… I bet I wrote it wrong once or twice when I was debugging. Thanks for looking into it grahm and jjayakumar.