GSSVGtoPath correct Method

I am getting error:

AttributeError: 'GSSVGtoPath' object has no attribute 'readFromURL_intoLayer_error_'

In the following script

from GlyphsApp import GSLayer
import objc
from Foundation import NSURL
GSSVGtoPath = objc.lookUpClass("GSSVGtoPath")

def convert_svg_to_glyphs_layer(svg_file_path):
    layer = GSLayer()
    svg_to_path = GSSVGtoPath.alloc().init()
    url = NSURL.fileURLWithPath_(svg_file_path)
    
    success = svg_to_path.readFromURL_intoLayer_error_(url, layer, None)
    if success:
        print(f"SVG converted successfully for {svg_file_path}")
        return layer
    else:
        print(f"Error during SVG conversion for {svg_file_path}")
        return None

What is the proper method or attribute for GSSVGtoPath in this case?

See here:

1 Like