I’m trying to use the knime:// protocol to read files that live outside of knime workflows. My team uses Box.com and we would like to be able to reference files in our knime workflows that live in the synced Box.com folder on each of computers. Currently we have some workflows that read files from absolute paths that are hard-coded and include individual users names (C:\Users\username), but I would like use relative file paths to read these files instead. We also have users on Linux that would like to be able to run the same workflows.
I/O Error while analying file: Can’t access ‘knime://knime.workflow/…/…/Documents/test.xlsx’. (Leaving the mount point is not allowed for workflow relative URLs).
You can use the global variable “knime.workspace”. For example, the expression below in the String Manipulation node gives you the absolute path to the directory in which the KNIME workspace exists which is the “Documents” folder on a standard local installation: regexReplace($${Sknime.workspace}$$, "\\\\[^\\\\]*$", "")
you can add anything to the path: regexReplace($${Sknime.workspace}$$, "\\\\[^\\\\]*$", "\\\\test.xlsx")
Thanks for your reply. Shouldn’t I be able to reference a file in Documents by:
knime://knime.workflow/../../Documents/text.xlsx
I’m not sure what I would do with your expression. I’m trying to use a simple File Reader node. What would I put in the box that says Enter ACSII data file location?
You can use the String Manipulation (Variable) node and use the expression to create the file location as a flow variable for the File Reader node (or any other nodes).
Nothing! After creating the location path using the “knime.workspace” variable in the String Manipulation (Variable) node, pass the variable to the File Reader node and click the small button next to the “Browse” button and assign select the variable.
Here is an example. Assumes you have a file (test.csv) in the directory where your KNIME workspace exists as well: