Hello Vladimir,
In that post the chunk definition has been missing, please check the updated script sample:
import Metashape
chunk = Metashape.app.document.chunk
for marker in chunk.markers:
for camera in list(marker.projections.keys()):
if not marker.projections[camera].pinned:
marker.projections[camera] = None