Relative paths in List Files and List Remote Files

I am working on a workflow that is stored in a git repo. The workflow needs to backtrack up the folder structure to access another folder using List Files. So I am trying to use the knime: protocol as follows:
knime://knime.workflow/…/…/…/searches/oil186

I get the error
Execute failed: Leaving the mount point is not allowed for workflow relative URLs: /home/clyde/source/repos/CEVOpen/workflows/knime/Mining_Oil186/…/…/…/searches/oil186 is not in /home/clyde/source/repos/CEVOpen/workflows/knime
This occurs on Windows, Mac and Ubuntu platforms.

This occurs for both List Files and List Remote Files. is this a KNIME issue or am I using the protocol wrong?

Hi. Try changing each occurrence of three dots to two dots in your knime protocol.
-Don

That’s down to this forum entirely. The path I pasted has two dots in it. The editor autocorrected it to it three dots

Hi. I’ve never seen this error message, but can make some educated guesses that might point you in the right direction (or KNIME folks could chime in). Is your KNIME workspace directory at /home/clyde/source/repos/CEVOpen/workflows/knime? And is your workflow called Mining_Oil186? If so, it seems the error is suggesting that you went one directory above your mountpoint, and hence “left the mountpoint”, which apparently isn’t allowed. If all of this is correct, a workaround might be to move the “searches” or “oil186” folder to a location under your knime folder.

2 Likes

I had suspected that might be the issue, thanks. But I’m not at liberty to do that as I am not the repo manager, and we need to keep the data files in oil186 on a separate branch of the tree.
This issue is a real pain in the nether regions and greatly hamstrings the portability of the workflow, because I need to store the actual path in a workflow variable and change it every time its run on another platform.
Can anything be done about it at all?

Hi. Hmm… If you know Java, you could use a Java Edit Variable node to define the relative path (or similarly for Python, etc.). Hope this helps.
By the way, I can see an advantage of disallowing leaving the mountpoint: this lets you move or copy the workflow repository and know that the relative paths will still work.

1 Like

Like @dnaki said Java Edit Node might help. You could extract the operating system via the extract system property. So depending on which OS you are you could change the absolute path.

https://nodepit.com/node/org.knime.base.node.io.extractsysprop.ReadSysPropertyNodeFactory

1 Like

I don’t know Java, sorry.

Thanks for the hint. I ended up using the Extract Context Properties node which provided me with the info I needed.

1 Like

One other point worth noting: you need to normalize the path before using the XML reader node as it doesn’t like double dots in it. So I used a Java Snippet to do this. Despite not knowing Java. :grinning:

2 Likes

The Java edit simple node should be relatively easy to handle.

Also string manipulation and converting the result to a variable could help.

1 Like

You can also translate the workflow relative link into a normal file path using the Explorer Browser node.

https://hub.knime.com/knime/extensions/org.knime.features.personalproductivity/latest/org.knime.explorer.nodes.browser.ExplorerBrowserNodeFactory

2 Likes

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