Skip to content

"No netlist" error when running a Python script on a netlist in commandline mode #590

@harnhua

Description

@harnhua

Hi,
After successfully loading a netlist and executing the following lines of sample Python code in the Python widget, I saved the commands in a .py script.

from hal_plugins import graph_algorithm

graph = graph_algorithm.NetlistGraph.from_netlist(netlist)

However, when I tried to load the project and execute the same commands in a .py script, HAL says that the "netlist" object does not exist.

hal --project-dir <directory containing HAL project> --python-script test.py
Looking at the log messages, it seems like the Python script was executed before the netlist was loaded.

[gate_library_parser] [info] registered gate library parser 'Default HGL Parser' for file extension '.hgl'.
[core] [info] executing 'python_shell' with
[core] [info]   '--python-script': netlists/graphing.py
Traceback (most recent call last):
  File "<string>", line 3, in <module>
NameError: name 'netlist' is not defined. Did you mean: 'Netlist'?

Am I missing an argument or Python command?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions