How to get the current file name via python?

Hi all,

I feel incredibly stupid asking this but I just can’t find the info anywhere, and RV’s API still does my head in every time I try to use it.
I am simply trying to get the current file path of a clip loaded in RV via python.
I used this (probably because somebody told me to in the past):

frame = commands.frameStart()
sources = commands.sourcesAtFrame(frame)
fileNames = commands.getStringProperty("" % sources[0], 0, 1000)

But that returns a sequence listing like this:
(u’LUM3_00054_010_V002.1001-1241@@@@@@.exr’, 1001, 1241, 1, 25.0, False, True)

I just need the actual file name/path instead.



Hey Frank!

@alexaz and I went over a couple options; it kinda comes down to what you want to do with it.

If you want the fast and easy approach, you can just query the source and ask for the media info. Something like this:

from rv import commands
frame = commands.frameStart()
sources = commands.sourcesAtFrame(frame)
metadata =  commands.sourceMediaInfo(sources[0])

# In the metadata, one key is 'file' which has your full path including sequence name.
file = metadata.get("file") 

I originally misinterpreted your request, but I think the answer has value. If you are looking for the specific file that you are reading from your sequence, you can do something along the lines of this:

import rv

# The difference here is that we traverse the graph to find not only the source, but also the source frame number.
info = rv.extra_commands.sourceMetaInfoAtFrame(rv.commands.frame())
metadata =  rv.commands.sourceMediaInfo(info['node'])
filename = metadata.get("file")
sourceFrame = info['frame']

# Note: this only works how we want it to for file sequences, error check to make sure you are dealing in file sequencese, as well as protecting yourself against missing framees.
files = rv.commands.existingFilesInSequence(filename)
frames = rv.commands.existingFramesInSequence(filename)

# Assmeble the files and frame numbers in something we can index into.
framesToFiles = dict(zip(frames, files))

# The result can be found here:

Hopefully those approaches find value in what you are trying to achieve.



Awesome, thanks, the first solution is all I need, thanks!


Dear Forum,

i want to skip/jump to a different frame on a timeline.
the rv sequence consists of several sources with different frame ranges.
on keypress i want to jump to the equal frame of a different source.

my first intend is to iterate over a list of the exact filenames of all given sources nodes (exact filepaths).

With your second solution i trigger metadata of every image and walking through the complete timeline is uneffective and time insufficient, to get a quick list of all images corresponding to the frame in timeline.

ps. if needed, i will open a seperate thread
and hope we can gather the info in one spot.
thanks in advance.


1 Like

Wouldn’t it be easier to switch to stack mode and use the () hotkeys to cycle through the clips (which will then be showing the same frame as you switch through them)?!

1 Like

my rv session is created from a script, which create a stack, with 2 sequences, each seq of them being different footages and frameranges aligned after another.
my wish is, to jump to the next frame in this sequence with the same frame number in the timeline.

@frank: comparing the same frame in a seperate stack is uncomfortable as the user wishes to use the stack mode / seq mode to compare the (pre) aligned seqs with each other.

“With your second solution i trigger metadata of every image and walking through the complete timeline is uneffective and time insufficient, to get a quick list of all images corresponding to the frame in timeline.” do you have another solution, a hint for me?

so my problem still exists in getting all the exact frames from a sequence to walk through.

any hints, tips, solution? :frowning: :slight_smile:

1 Like

@ewok1 Are each of your sequences different lengths? Is the built-in feature for jumping between the similar frame not working for your situation? (keyboard shortcut > and <)?

If not, what’s different about your case than < and > do?


1 Like


I am having a similar problem but whatever I try, I cannot get the complete source path for the current frame because the path is including the frame range (e.g. bla/bla_image.1000-1200@.exr)

I am on RV 7.3.4. I am wondering why the sourceAttributes command is not returning the current frame but the range instead…

Ultimately I just want to grab the metadata at the current frame but it will only be the first frames metadata. I also tried contructing the filepath myself but sourceAttributes doesn’t return values if I replace the media argment with a filepath.



Ok, I found that the sourceInfo command only returns the current frame data when no media is specified. Once media is supplied it only returns the data for the first frame in the sequence. Is that intentional?