How does one obtain the local coordinate information for...

Okay, here’s the situation.

You have a camera with a ‘Track To’ constraint on it, aiming it at an empty.

As you move the camera, its local axes reflect the movement by changing orientation. (The local Z axis always points away from the empty, and the X and Y axes also have their own consistent orientation with respect to the camera, but they change orientation with respect to the world).

The puzzler I can’t solve:

How does one read the local orientation of the camera X and Y axes, such that the camera can be moved via script in its own local X and Y directions, without changing the Z orientation?

Thanks to anyone willing to help.

you can get the matrix
mat = ob.matrixWorld - from that you can do
rot = mat.rotationPart()
sca = mat.scalePart()
loc = mat.translationPart()

or you can just do
loc = ob.getLocation(‘worldspace’)