Skip to content

Support pathlib.Path in Python API #1535

@nikosavola

Description

@nikosavola

Hi, I always forget to cast Paths to strings while using the Python API. For example

from pathlib import Path
import klayout.db as db

some_path = Path.cwd().parent

...
l2n = db.LayoutToNetlist(SOME_CELL.begin_shapes_rec(0))
l2n.extract_netlist()
l2n.netlist().write(some_path / "netlist.spice", ...)

will fail as some_path / "netlist.spice" is not actually supported and needs to be converted to a string . I was wondering would there be a simple way to do this conversion in the KLayout API side before the underlying C++ calls instead?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions