As indicated by @AlexTereshenkov in a comment:
You need to run the mxd.save() in your script as the last step.
Opening an ArcPy MapDocument object from an MXD using a full pathname to that file is NOT the same as having that MXD open in ArcMap and being referenced as the "CURRENT" map document.
If I open a map document which has no layers in ArcMap, add a layer and run your code using "CURRENT" I would expect to see that layer reported because the current map document object "knows" what has been done to it (i.e. it had a layer added).
If I then open the map document using your code and its full pathname, then I am accessing what that MXD file contained prior to the last save which was performed on it from either ArcMap or using mxd.save()
from ArcPy. If no save was performed between adding the layer, and running your code, then I would expect no layers to be reported and I would not expect to get an error.
mxd.save()
in your script as the last step.