On 19/08/2015 at 06:18, xxxxxxxx wrote:
We are trying to develop a (Tag) plugin to switch camera's from the command line. We thought we had it working since it works when we open a c4d file in the GUI and it switches to the right camera, but when we render on the render farm (command line / nogui) it doesn't work. It gives us:
File "'CommandLine.pyp'", line 31, in Execute
AttributeError: 'module' object has no attribute 'argv'
In the log
This is the code:
print 'Number of arguments:', len(sys.argv), 'arguments.'
print 'Argument List:', str(sys.argv)
opts, args = getopt.getopt(sys.argv,"c:s:",["camera=","setting="])
except getopt.GetoptError as err:
print "Error: Unknown command line options!"
print "We only support -c|--camera= -s|--setting="
camera = ''
setting = ''
for opt, arg in opts:
if opt in ("-c", "--camera") :
camera = arg
print "camera = ", camera
elif opt in ("-s", "--setting") :
setting = arg
print "setting = ", setting
commandRead = 1
adraw = doc.GetActiveBaseDraw()
roots = doc.GetObjects()
cameraFound = 0
for obj in roots:
if obj.GetName() == camera:
cameraFound = 1
if cameraFound == 1:
camname = adraw.GetSceneCamera(doc).GetName()
print "Camera :", camname, "selected"
print "Camera not Found!"
Is getopt not availble during load? Of are we missing something here? I hope someone can help. We need this for a customer job.