knime / knimepy

Other
44 stars 15 forks source link

python KNIME error #32

Closed choa0707 closed 3 years ago

choa0707 commented 3 years ago

I tried to execute knime workflow but I received this: WARNING:root:Return code from KNIME execution was non-zero WARNING:root:captured stdout: b'CompilerOracle: exclude javax/swing/text/GlyphView.getBreakSpot\nInstall location:\n file:/c:/Program Files/KNIME/\r\nConfiguration file:\n file:/c:/Program Files/KNIME/configuration/config.ini loaded\r\nConfiguration location:\n file:/c:/Program Files/KNIME/configuration/\r\nFramework located:\n file:/c:/Program Files/KNIME/plugins/org.eclipse.osgi_3.15.200.v20200214-1600.jar\r\nLoading extension: reference:file:org.eclipse.osgi.compatibility.state_1.1.700.v20200207-2156.jar\r\n\teclipse.properties not found\r\nLoading extension: reference:file:javax.transaction_1.1.1.v201105210645.jar\r\n\teclipse.properties not found\r\nFramework classpath:\r\n file:/c:/Program Files/KNIME/plugins/org.eclipse.osgi_3.15.200.v20200214-1600.jar\r\n file:/c:/Program Files/KNIME/plugins/\r\n file:/c:/Program Files/KNIME/plugins/org.eclipse.osgi.compatibility.state_1.1.700.v20200207-2156.jar\r\n file:/c:/Program Files/KNIME/plugins/javax.transaction_1.1.1.v201105210645.jar\r\nDebug options:\n
.......... .......... ..........

This is my code in python : import knime knime.executable_path = r"C:\Program Files\KNIME\knime.exe" with knime.Workflow(r"C:\Users\Choa\Desktop\test.knwf") as wf: wf.execute()

and my workflow is simply read csv and csv writer.

applio commented 3 years ago

At the time of this writing, knimepy does not support the execution of workflow archive files (i.e. '*.knwf' files), only workflows that have been opened by KNIME AP into their own workflow directory on disk.

The error message that you see should be verbatim what we receive back from KNIME when it struggles to figure out what to do with the workflow archive file but what you shared looks to be truncated. I suggest trying the following in your code when encountering strange behavior:

    wf.execute(live_passthru_stdout_stderr=True)

Locally on a Windows 10 system, I created a KNIME workflow containing only a CSV Reader and CSV Writer and I was able to execute it successfully using the workflow's path on disk (not as a workflow archive file):

with knime.Workflow(r'C:\Users\Davin Potts\knime-workspace\knimepy_issue_32') as wf:
    wf.execute()

Actually, the first time I tried executing it, it failed because I forgot that I still had the workflow open in the KNIME GUI. (KNIME will not let you run a workflow that is already open in another instance of KNIME.) I closed the workflow in the KNIME GUI but kept the KNIME GUI open for my other workflows, then I tried executing it through knimepy and was successful. I mention this as encouragement to turn on options like live_passthru_stdout_stderr because in the captured stderr was this helpful/important clue:

ERROR     main BatchExecutor     Workflow is locked by another KNIME instance