Reference the latest ring into Maya file

Viewed 66

Often I need to reference a Light Rig into my working file to check modelling and texture, and just wanna add a button for it. The issue is to grab the latest file version and reference it, but it returns this error:

# Error: 3
# Traceback (most recent call last):
#   File "<maya console>", line 6, in <module>
# WindowsError: [Error 3] The system cannot find the path specified: 'D:......scenes/*.*' # 

Here is what I have tried.

import maya.cmds as cmds
import os

# >>> path to get latest rig file version and name
fileVersionPath = os.path.join("D:.......\scenes")
fileList = sorted([f for f in os.listdir(fileVersionPath) if f.endswith('.ma')])
fileName = fileList[-1]

# >>> import template using path
cmds.file("fileName",i=True, dns=True)
0 Answers
Related