This is explained here: Scripting: Upgrading to Python 3 | Glyphs
And I would write it like this:
#c = Layer.selection[0]
#c.componentMasterId = Font.masters[1].id
#MenuTitle: Remove External Overlaps
# -*- coding: utf-8 -*-
__doc__="""
Removes external overlaps for selected Glyphs
"""
import GlyphsApp
from GlyphsApp import GSPathPen
ListOfSelectedGlyphs = [ l for l in Font.selectedLayers if hasattr(l.parent, 'name')]
for thisLayer in ListOfSelectedGlyphs:
for path in thisLayer.paths:
pen = GSPathPen.new()
path.drawInPen_(pen)
newPath = pen.layer().paths[0]
path.nodes = newPath.nodes