Using python nodes on server

Dear KNIME Community,

I would like to use a python script (and in particular openpyxl library) in order to format an excel file.
I know there are the continental nodes to do so, but this python library make the process really straightforward and avoid to add several nodes to the workflow.

The main issue is the path. As python node does not understand a relative path (e.g. knime://knime.workflow/data/john_doe_records.xlsx) I have to write the entire path :

image

‘C:/Users/<user_name>/knime-workspace_4.5.1/MY_NODES/python_openpyxl_test/data/john_doe_records.xlsx’, which is ok when running the workflow locally ……

image

How to tell python where to find the file on the server ?
Many thanks,

Hi @Fra_S3k_knime,

Please use the Extract System Properties – KNIME Hub Node to get the path to the Executor’s Workspace in order to create the full path to your resources.

Best,
MIchael

Hi @MichaelRespondek, and thanks a lot for your answer!

I had tried with Extract System Properties and Extract Context Properties too. Locally, they do a wonderful job but it seems they does not like the server environment and go on an eternal queue (both If I execute as a job or via web portal) :

image

I was thinking on a get request but it is quite unclear for me where the data workflow or the tmp folder with data are on server…

I was wrong as the issue was the Server (too busy). Know Extract System Properties and Extract Context Properties worked well. Unfortunately, I am still unable to understand hot to tell python where it should find the .xlsx file, as paths like :

@config.dir/…/p2/ (eclipse.p2.data.area - from ESP)

and

/tmp/TEST_ECP832237644701448944/TEST_ECP (context.workflow.absolute.path - from ESP)
*adding “/data”

are not understandable for the python node yet, and I don’t know how to modify them (i know how to do it technically but not which is the correct path/url)

Could you provide me with further guidance ?

Many thanks

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