Get all plugin data for every Houdini version?

   580   2   2
User Avatar
Member
8 posts
Joined: March 2017
Offline
For context, I am on Windows.

I have a python 3.9 project (not integrated with Houdini in any way). I have multiple versions of Houdini installed such as H19.5 and H20. For both of those installs, I need my python project to grab all of the processed package config data that Houdini locates in /packages in the .json files there. This data contains the paths to any given plugin location on disk as environment variables, among other config data, which allows Houdini to actually locate and load plugins.

Since those .json package files can contain variables that need to be resolved, on startup, Houdini will resolve the config files to produce absolute file paths and such. I believe Houdini does this through hconfig.exe, since if you call hconfig.exe through python (using the subprocess command), it will give you that exactly nice processed data.

The problem is I don't know how to get that data for every Houdini install. My python project is using Python3.9. But if I try to run H20's hconfig.exe from Python3.9, I will get an error saying 3.9 and 3.10 are incompatible. This is because H20 ships with python3.10.

I do not want to change the python version my project is built upon every time Houdini ships with a new python version. I'd like it to be future proof for all future Houdini versions. Is there an easy way to get all the processed package data for all Houdini installs found on disk?

I've played around with hython and managed to get it to output all that useful processed package data using:
# import os 
# os.environ

# nevermind (ignore above code), this is better code that only gives the plugin paths
hou.getenv("houdini_path")


The issue is that all the env vars are mixed together (not separated by which config file they originated from) and they're also mixed in with a whole lot of other data I don't want.
There's also a large loading time overhead by starting up hython, which I don't want to do for every installed Houdini just to get some env var data.

What's the solution here? How do I easily get this data in a clean and efficient way?
Edited by WhyIsHoudiniSoHardHelp - Nov. 21, 2023 18:15:05
User Avatar
Staff
399 posts
Joined: Feb. 2018
Online
Have you tried hou.ui.packageInfo to access all loaded packages ?
Edited by mabelzile - Nov. 21, 2023 10:13:24
User Avatar
Member
253 posts
Joined: July 2013
Offline
Not sure of it helps in this case but you can use if-statements in the package json and check again houdini mayor version number to only load/set certain things depending on houdini versions.
More code, less clicks.
  • Quick Links