Last active
December 29, 2022 17:43
-
-
Save elliotnev27/82f87bc125845ada68fe90ae4ee5cc0b to your computer and use it in GitHub Desktop.
Python snipped to get local Autodesk Flame Projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import re | |
def get_local_flame_projects(): | |
"""Get all flame projets from /opt/Autodesk/io/bin/flame_archive -l | |
Returns: | |
list: This is a list of the flame projects that exist on the workstation | |
""" | |
project_list = [] | |
proc = subprocess.Popen(['/opt/Autodesk/io/bin/flame_archive', '-l'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
output = proc.communicate()[0] | |
if isinstance(output, bytes): | |
output = output.decode('utf-8') | |
proj_trip = False | |
for proj in output.split('\n'): | |
proj = re.sub(r'^\s+', '', proj) | |
if re.search(r'(?i)stopping managed threads\.', proj): | |
break | |
if re.search(r'(?i)^projects:', proj): | |
proj_trip = True | |
continue | |
if not proj_trip: | |
continue | |
project_list.append(proj) | |
return project_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment