In my use case i am using the absolute-path value to derive the path of file for a downstream python node. The workflow executes successfully when running locally however when execute on Knime Business hub, the python node fails as the path is not found/valid.
Hi,
I just tried it on my Hub and my file path looks like this: /tmp/*oaDafsLpf7wjNDR_11335252890352028965/AbsolutePathTest. I passed that to a Python Script with this code:
import knime.scripting.io as knio
import os
import pandas as pd
# specify the directory you want to list files from
directory = knio.flow_variables["context.workflow.absolute-path"] + '/data'
# use os.listdir to get the list of files
files = os.listdir(directory)
# convert the list of files to a pandas DataFrame
df = pd.DataFrame(files, columns=['File Names'])
# output the DataFrame as a KNIME table
knio.output_tables[0] = knio.Table.from_pandas(df)
And that script correctly listed the files in the data directory of my workflow.
Kind regards,
Alexander