Hello xinglei.
I think the Python Console in your current Metashape instance is broken by incorrect use of some other code that is not posted here, for example, if you have used marker.Refernece.enabled = False assignment or similar with incorrect use of the caps letters. I suggest to re-start Metashape and use proper assignment, as posted in your script.