I want camera to be rotated around y-axis, for an object placed at centre. Its rotating around z and x-axis, but not y-axis. I am attaching the code snippet.
import bpy
import math
scene = bpy.context.scene
context = bpy.context
cam = scene.objects['Camera']
cam.location = (0, 1, 0.6)
cam.data.lens = 35
cam.data.sensor_width = 32
cam_constraint = cam.constraints.new(type='TRACK_TO')
cam_constraint.track_axis = 'TRACK_NEGATIVE_Z'
cam_constraint.up_axis = 'UP_Y'
cam_empty = bpy.data.objects.new("Empty", None)
cam_empty.location = (0, 0, 0)
cam.parent = cam_empty
scene.collection.objects.link(cam_empty)
context.view_layer.objects.active = cam_empty
cam_constraint.target = cam_empty
stepsize = 30
cam_empty.rotation_euler[2] += math.radians(stepsize)
As per my understanding, "rotation_euler[2]" makes the camera rotate around z-axis. When I replace "[2]" with "[0]", the camera rotates around x-axis. But if I replace it with "[1]", the camera does not rotate.