Vrscene Dependency Scraper Python script

Follow
Any external files that a vrscene file depends upon (image files, etc) will need to be uploaded to conductor.  As noted in the docs, these paths must be specified in the Job’s upload_paths argument upon job submission.  Typically Conductor does this “dependency scraping” when using the submitter gui, but for submitting vrscene files directly, you’ll need to scrape them manually  That being said, this simple python script may aid you in doing so.
parse_vrscene_paths.py

import re
REGEX_FILE_PROPERTY = r'\s+file\=["\']?(?P<path>[^"\']+)["\']?'
def parse_paths(vrscene_filepath):
    '''
    Parse the ascii content of the given vrscene for all paths
    that are referenced. This is accomplished by regexing 
    for string patterns the match:
        file=
    '''
    paths = []
    with open(vrscene_filepath) as file_:
        for line in file_:
            match = re.match(REGEX_FILE_PROPERTY, line)
            if match:
                paths.append(match.groupdict()["path"])
    return sorted(set(paths))