[Python] Getting "DENIED" error while trying to work with camera

When my own code gave me this error I suspected I’d made a mistake and I downloaded the example camera.py from the GitHub repo at https://github.com/mavlink/MAVSDK-Python/blob/master/examples/camera.py
The program outputs this:
Waiting for mavsdk_server to be ready…
Connected to mavsdk_server!
Waiting for drone to connect…
Drone discovered with UUID: 5283920058631409231
Setting mode to ‘PHOTO’
Camera mode: UNKNOWN
Setting mode failed with error code: DENIED
Taking a photo
Couldn’t take photo: DENIED

First I run the mavsdk server with the following command:
~/MAVSDK/build/default/src/backend/src/mavsdk_server -p 50051

Then I launch gazebo simulator using the following command from the base directory of the PX4/Firmware repo clone:
make px4_sitl gazebo

Then I launch camera.py and get the aforementioned error. What might be wrong?
(I’m very new to mavsdk and px4 and this is my first post on the forum so if my question is poorly structured or missing key details sorry)(I couldn’t find anything helpful on Google)