RV Python quickstart

RV now ships with Python in addition to Mu for scripting and extending the application cross platform. Python is a full peer to Mu as far as RV is concerned. The command API is almost identical between the two.

In order to extend RV using Python you will be making a "mode" as part of an rvpkg package—this is identical to the way it’s done in Mu and this is the method that we use internally to add new functions to RV's interface. Creation of a modes and packages is documented in the reference manual. Please read the relevant sections to understand how it’s done. Here is a very simple mode written in Python which is part of $RV_HOME/rvpkgs/pyhello-1.0.rvpkg. You can add and install $RV_HOME/rvpkgs/pyhello-1.0.rvpkg to see it working.

import rv.rvtypesimport rv.commands

class PyHello(rv.rvtypes.MinorMode): "A simple example that shows how to make shift-Z start/stop playback"

Documentation:

The command API is nearly identical to Mu. There are a few modules which are important to know about: rv.rvtypes, rv.commands, rv.extra_commands, and rv.rvui. These implement the base Python interface to RV.

We currently do not have separate documentation for RV's command API in Python (e.g., via Pydoc), but you can use the existing Mu Command API Browser available under RV's Help menu. The commands and extra_commands modules are basically identical between the two languages. We hope to have a Pydoc solution in the future.

If you are not familiar with Python please visit python.org to find relevant documentation, books, and tutorials. We cannot answer support questions about Python the language but we are happy to help with questions regarding RV's Python integration and Python command API.

10 Comments

Awesome! can't wait to test this. Can you correct the example to remove the from module import * statements? because you have two of them, we can't tell which modules the different items are coming from. Would prefer a from rv import commands followed by declarations using the full commands.play() form. (and it's more pythonic ;-) )

The rv module is only available from packages being run by an interactive RV process. You cannot load them outside of RV. Are you trying to do that by chance or are you having trouble getting your package working?

If you are using RV version 7 or higher and Shotgun credentials to authenticate RV, the Shotgun Review package has a ToolKit driven Python Console for RV. You can use that.

Also included with every release of RV is a companion application called rvshell that, as a proof of concept sample, allows you to send remote commands to an RV instance over the network protocol. This can be used to send pyexec, pyeval, and mueval events to a running RV. Please read more about that here: