Python Node Development - Icon Paths

Hello KNIMErs,

as I am developing my nodes I ran into a problem regarding my icon path.

My folder structure looks like this:

extension-folder
...
- icons
- - icon.png
- src
- - nodes
- - - node.py

(please excuse this not so beautiful representation of it)

Now to my issue.
Whenever I try to implement my node like this:

@knext.node(
    name="Create Browser Session",
    node_type=knext.NodeType.OTHER,
    icon_path="icons/icon.png",
    category=category
)

The icon is not shown in the KAP.

When I put my “icon.png” in the “nodes” folder and I use

icon_path="icon.png",

it works.


I have also tried using:

icon_path="icons\icon.png",

and

icon_path=r"icons/icon.png",

I have looked at these two repositories:

They both utilize different solutions. None work for me.

Any ideas?

Thanks you in advance!

Solved!

Although I was sure I tried to use "../", it did not work.
But what can I say…it does work.

@knext.node(
    name="Create Browser Session",
    node_type=knext.NodeType.OTHER,
    icon_path="../icons/icon.png",
    category=category
)
3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.