PySide2 not found on Windows

   1212   4   2
User Avatar
Member
180 posts
Joined: Dec. 2011
Offline
I'm using Houdini 16 and for some reason whenever I try to import anything from PySide2 (for pypanels or in shelf tools) it says that the module does not exist. However, I am able to import my system's PySide module just fine.

I tried hunting down where the PySide2 modules are stored in Houdini's installation files and can't find them for the life of me. Any idea where these reside?
User Avatar
Member
20 posts
Joined: Oct. 2016
Offline
How are you importing PySide2 modules?
Does this return an error? This is the way I import it on my shelf tools and works just fine.

from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *

Rok Andic
www.rokandic.com
User Avatar
Staff
1082 posts
Joined: July 2005
Offline
NFX
I'm using Houdini 16 and for some reason whenever I try to import anything from PySide2 (for pypanels or in shelf tools) it says that the module does not exist. However, I am able to import my system's PySide module just fine.

I tried hunting down where the PySide2 modules are stored in Houdini's installation files and can't find them for the life of me. Any idea where these reside?

Hello,

Just to confirm, are you running the main (Qt5) build of Houdini? Or are you running the Qt4 build?

Also, the PySide2 modules are located in %HFS%/python27/lib/site-packages-ui-forced.

Cheers,
Rob
User Avatar
Member
180 posts
Joined: Dec. 2011
Offline
Well what do you know, it is the Qt4 build…

That would explain why the folder at %HFS%/python27/lib/site-packages-ui-forced was labelled PySide rather than PySide2.

I didn't know there was even an option to get a different version.

If I want to build a tool that works on both builds of houdini, what would be the right way of testing which PySide to use? A set of try: except: import statements?
Edited by NFX - March 23, 2018 11:42:06
User Avatar
Member
17 posts
Joined: March 2015
Offline
You can do something like this:
import imp
try:
    imp.find_module('PySide')
    found = True
except ImportError:
    found = False
and than make necessary ‘if’s based on ‘found’ to alter code when something is not working in both versions?
  • Quick Links