Broken path to code library

tsonesound's Avatar

tsonesound

28 Sep, 2024 07:18 AM

I've run into an odd issue with NodeBox files with dependencies not opening. I have a number of NodeBox projects which use Perlin noise built in Clojure. When I try to open them I receive an error window indicating a problem opening the clj file because the path doesn't exist. The weird thing is the path referenced in the error message is the real path the clj file lives in but repeated 4 times
(like: path_to_cljFile/path_to_cljFile/path_to_cljFile/path_to_cljFile ) ...so, of course this path doesn't exist, and that explains why it won't open.
Adding to the confusion, when I open the NodeBox file as xml it shows the path to the clj file is as it should be (not quadrupled like in the error). Also, this problem only occurs with a few NodeBox projects that depend on this code library. Other projects with this dependency will open just fine.
I'd love to reopen these files and continue to work on the projects (and maybe fix the weird file path thing). Is there any way to disable dependencies when opening a NodeBox project?
Any suggestions would be greatly appreciated.

-Tony

  1. Support Staff 1 Posted by john on 28 Sep, 2024 08:08 AM

    john's Avatar

    Hi Tony,

    This is an all-too-common occurrence whenever people use external code modules. The problem is that when people make their Nodebox projects, they add the code module located in a particular directory, and then later move their project relative to the code module or move the module relative to their directory or enclose one in a new directory or whatever.

    OR they download a Nodebox project with a reference to a particular directory in the file path of the person posting the project which, of course, doesn't exist on their system.

    Sadly, Nodebox does not react well to these little mishaps. It simply refuses to open the Nodebox file at all and belches forth an inscrutable error message. This is why I try to avoid using external code modules whenever I can.

    Fortunately there is a fairly easy fix.

    Just open your NDBX file using a text editor. SEE ATTACHED PHOTO for an example.

    An NDBX file is just an XML file and can be safely edited. All you need to do is remove the line or lines which reference the code module. This will normally be line 7, or several lines starting at line 7 if you have more than one code module in your library, The lines will begin <link href="code module" where code module is the name of your module, e.g. clojure:noise.clj.

    Just select that line or lines and delete it or them (being careful not to delete anything else). Save, relaunch your NDBX file, and it should open fine. You will then need to RE-ADD your module(s) using the normal File/Code Libraries... menu.

    I have no idea how or why the module reference could be chained together four times, but just try removing the whole thing in your text file then re-adding the CLJ module.

    My advice to avoid this kind of thing whenever you want to add a module:

    • STOP
    • SAVE
    • EXIT Nodebox
    • Create a folder just for your project
    • Move your NDBX file into that folder
    • Move a COPY of your module (your .py or .clj file) into the same folder
    • Reopen your Nodebox file
    • Add the module referring to the copy in the same folder

    In this way your module will always live in the same folder as the Nodebox file and the link won't break even if you move that folder or put it into another folder. And if you want to share your project, ZIP THE ENTIRE FOLDER. That way the project and any code modules it needs will always stay together, even on other people's systems.

    BY THE WAY

    I recently added a version of this very same Perlin Noise algorithm into my Cartan Node Library as a node you can just copy and paste. My node uses the same module but wraps it with an extra scale parameter that will save you a little work each time. You will still need to add a COPY of the noise.clj module and wrap everything together in a folder:

    http://support.nodebox.net/discussions/show-your-work/748-perlin-noise

    Let me know if this solves your problem!

    John

  2. 2 Posted by tsonesound on 28 Sep, 2024 06:53 PM

    tsonesound's Avatar

    Hi John,
    I knew you'd have the solution I was looking for! That totally worked. Many thanks!
    I had a hunch there was probably a best practice for bundling all the project files. Thanks for setting me straight on that.

    I'll definitely be checking out your Perlin noise node.

    I've attached a still from the animation of the project I was trying to open. The results were very cool! Very much like sand dollars or sea anemone.

    Many thanks,
    -Tony

  3. Support Staff 3 Posted by john on 29 Sep, 2024 03:27 AM

    john's Avatar

    Tony,

    Wow! Those stills are way cool! I would love to see the animation. Is it posted anywhere?

  4. 4 Posted by lastvector on 29 Sep, 2024 09:53 AM

    lastvector's Avatar

    Tony

    i like that too
    the pics looks very cool

    gottfried

  5. 5 Posted by tsonesound on 29 Sep, 2024 08:45 PM

    tsonesound's Avatar
  6. 6 Posted by lastvector on 30 Sep, 2024 11:11 AM

    lastvector's Avatar

    the animation looks cool too !

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

01 Oct, 2024 07:59 AM
30 Sep, 2024 11:37 PM
30 Sep, 2024 11:11 AM
30 Sep, 2024 02:37 AM
28 Sep, 2024 10:33 AM

 

26 Sep, 2024 06:41 AM
24 Sep, 2024 12:32 AM
24 Sep, 2024 12:27 AM
13 Sep, 2024 12:07 AM
12 Sep, 2024 11:54 PM
07 Sep, 2024 05:16 AM