How to use RVIO with your included RV license

Did you know that you can use RVIO with your RV license without a separate RVIO license?

There’s one major caveat, it must be a subprocess of an actively licensed interactive RV session.

This is useful for things like custom exporters from RV or if you want to make an embedded tool in RV that uses RVIO; it doesn’t even need to work on things in your current RV session!

All you need to do is:

  1. Call commands.rvioSetup()
  2. Immediately after calling commands.rvioSetup(), subprocess your RVIO command (for instance, with the subprocess module in Python).

This doesn’t cover cases like running RVIO on a machine where someone isn’t directly running RV, such as a render farm. If you make use of this already, please give this thread a shout with what you’ve made to inspire others!

5 Likes

Hi I can’t get the license to work, in this way, I might be missing something? Thanks!

I’m try executing this via two ways:

./rv -pyeval “execfile(’/path/to/file.py’)”
./rv -pyeval “import sys;sys.path.append(’/path/to’);import file”

without luck : ( the content of “file.py” being something like this:

import rv.commands as rvc
import subprocess
rvio = os.environ.get(“RV_APP_RVIO”, None)
args = [rvio, “-vv”, “/path/test.tif”, “-o”, “/path/test.jpg”]
rvc.rvioSetup()
try:
out = subprocess.check_output(args)
except subprocess.CalledProcessError as exc:
print("Error: " + str(exc))

Output error:

ERROR: can’t get rvio or rv license
returned non-zero exit status 255

1 Like

Hi macbeth,

Thank you for posting on the forum!

Looks like you’ve found an edge case by launching pyeval from the command line. Looks like Python evaluation happens BEFORE RV authenticates, which means that no temp license is generated for the rvc.rvioSetup(). Whoops!

You can get around this by explicitly binding your code to execute after the RV authenticates, in this case the event is license-state-transition. Here’s the modified code that works for me:

import os
import rv.commands as rvc
import subprocess

def runCustomRVIO(event):

    event.reject()

    rvio = os.environ.get("RV_APP_RVIO", None)
    args = [rvio, "-vv", "/path/to/input.tiff", "-o", "/path/to/output.jpg"]

    try:
        rvc.rvioSetup()
        out = subprocess.check_output(args)
        print("OUT:", out)
    except subprocess.CalledProcessError as exc:
        print("Error: " + str(exc))

    # Close out the session after running
    rvc.close()

## Bind to the event that runs AFTER the RV sets up its license login
rvc.bind("default", "global", "license-state-transition", runCustomRVIO, "Run Custom RVIO")

Thanks to @Michael.Kessler for pair debugging this!

Let us know if this helps.

– Alexa

3 Likes

Btw, if you’d like to utilize RV’s progress bar for UI-friendly media export, take a look at a package I’ve just posted:

3 Likes

It works as expected! Thanks a lot for info :smiley:

3 Likes