Python Node Development - Icons not visible after bundling

Hello KNIMErs,

after successfully bundling my nodes I wanted to test them locally.
I am able to see my nodes in the repository.

However my Icons are not visible anymore.

image

Please let me know what I should provide to investigate this further.

Maybe @AD1529 / @Daniela_Rotelli has experienced a similiar issue before?

Note: Extension is written in Python.

Hey there,

maybe you can share your folder structure and sample code for one of your nodes that shows how you are referencing them etc.

I take that before building when you are developing everything works fine and the icons were visible?

For my extension:

  • src
    • extension.py
    • nodes
      • node1.py
    • icons
      • icon1.png

works.

I then import like:

@knext.node(
    name="node1",
    node_type=knext.NodeType.MANIPULATOR,
    icon_path="icons/icon1.png",
    category="/community/web"
)

Currently bundling an update of my extension as well - so will check that the icons as per usual work just in case… Update: Running into other issues… maybe you can do me a favor and try installing my latest bundle (see new topic opened by myself…)

Hey,

yes sure I will share my code - and yes during development everything looks fine.

My Folder structure:

  • extension
    • icons (folder)
      • icon.png
    • src (folder)
      • nodes (folder)
        • node.py

Excerpt from my node:

@knext.node(
    name="Close Window",
    node_type=knext.NodeType.OTHER,
    icon_path="../icons/icon.png",
    category=category,
)

Thanks a lot for sharing that.

Where’s your extension.py? in extension folder or in source folder?

Based on the icon_path I assume it is in src…

Yes, the extension file is located in the src folder.

Hmm then from my perspective your code is fine.

Can you maybe add some debugging code that helps you monitor this in console in “classical UI”:

import os

# Print current working directory
current_dir = os.getcwd()
print(f"Current working directory: {current_dir}")

# Define the relative path to check
relative_path = "../icons/icon.png"


if os.path.exists(relative_path):
    print(f"Path exists: {relative_path}")
else:
    print(f"Path does not exist: {relative_path}")

Is it an option to move the icons folder into the src folder and then go “icons/icon.png”?

I moved the icons-folder into src-folder and changed the path as suggested.

After bundling successfully bundling and installing, we now have icons! :slight_smile:

Thanks for your support @MartinDDDD!

2 Likes

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