Skip to content

SPICE reader: quoted include paths don't get expanded #1321

Description

@fsitok

Using KLayout as a spice parser for lctime we noticed some difficulties with include paths starting with "~".

This example with two minimal SPICE files demonstrates the problem:

top.sp:


.include "~/include.sp"

$HOME/include.sp: (empty file)

Minimal code for triggering the problem:

import klayout.db as db

n = db.Netlist()
n.read("top.sp", db.NetlistSpiceReader())

Yields:

Traceback (most recent call last):
  File "/home/user/lctime_issue4/lctime_issue4.py", line 4, in <module>
    n.read("top.sp", db.NetlistSpiceReader())
RuntimeError: Unable to open file: ./~/include.sp (errno=2) in top.sp, line 2 in Netlist.read

However, ngspice seems to be able to handle such include paths.
ngspice top.sp runs without error.

It looks like include paths in quotes are not expanded (the ~ should expand to the home directory) but instead treated as relative paths.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions