Hello Roy,
Are you running your script from Metashape GUI (from Run Script dialog) or are using headless script or stand-alone Metashape Python module? If you are using headless scripts, run from the OS terminal, you need to use different approach:
doc = Metashape.Document()
doc.open(path)
Do you observe the same problem, if you open new Metashape instance and input these lines one by one (including the path variable definition) to the Console pane?
I would assume that there were some previous commands that have affected Python interpreter due to some misused commands, for example "doc = Metashape.app.document.open" or something like that.