[solved] Host query


How do you query the host in a plugin?


You can call this.

import pyblish.plugin
print pyblish.plugin.current_host()

It was just included in the public API, and will be part of the next release (1.0.16) as this:

import pyblish.api
print pyblish.api.current_host()

But the above will not go away and is safe to use.


I was actually doing it manually until now.

 import sys

 host = sys.executable.lower()

    def process_context(self, context):
        if "nuke" in self.host:
            current_file = self.process_nuke()
            current_file = os.path.normpath(current_file)
        elif "maya" in self.host:
            current_file = self.process_houdini()
        elif "houdini" in self.host:
            current_file = self.process_houdini()
            print current_file
            current_file = None
            self.log.warning('Workfile selection in current host is not supported yet!')


You could use pyblish.plugin but in general, consider anything not coming from pyblish.api to be implementation detail that may change without notice, whereas everything part of the API will remain fixed and versioned until we hit a next major version increment - e.g. 2.0.

I should say, “will not go away anytime soon”.


On the latest version of pyblish-win and pyblish.api.current_host() doesn’t seem to work.


Do you think you could be a little more specific? :smile:

Also, I’m also thinking you might still have .pyc files lying around since updating. They are always loaded first and won’t have gotten updated if you didn’t do a hard reset first.


Sorry, this is working. I wasn’t on the latest pyblish-win. Did a complete remove and re-download, and its working now.


Awesome, thanks for the update!


Quick thought, what do you think about adding a [solved] prefix to support threads that have been solved? Similar to how Qt does it.

Alternatively, we could have a look at adding support for “tags”, similar to StackOverflow, such that we could tag threads with Solved.