3

使用 Pentaho PDI 6,具有:

A) .csv 上的 CSV 输入(来自 IBM 的 4 行 .csv),带有 ASCII 文件编码(预览行工作正常)

连接到

B) CPython Script Executor,可从 Tools -> MarketPlace 安装。假设安装了 Python、Pandas、Numpy。脚本设置:

配置、输入帧:(上一步)、df
Python 脚本、手动 Python 脚本:df.replace(to_replace= "\[|\]|'|\"", value='', regex=True, inplace=True)
输出字段、输出字段:(列名、字符串类型)

投掷

2016/07/25 10:45:21 - CPython Script Executor.0 - ERROR (version 6.1.0.1-196, build 1 from 2016-04-07 12.08.49 by buildguy) : Unexpected error
2016/07/25 10:45:21 - CPython Script Executor.0 - ERROR (version 6.1.0.1-196, build 1 from 2016-04-07 12.08.49 by buildguy) : java.lang.NullPointerException
2016/07/25 10:45:21 - CPython Script Executor.0 - 	at org.pentaho.python.PythonSession.rowsToPythonDataFrame(PythonSession.java:389)
2016/07/25 10:45:21 - CPython Script Executor.0 - 	at org.pentaho.di.trans.steps.cpythonscriptexecutor.CPythonScriptExecutor.rowsToPyDataFrame(CPythonScriptExecutor.java:458)
2016/07/25 10:45:21 - CPython Script Executor.0 - 	at org.pentaho.di.trans.steps.cpythonscriptexecutor.CPythonScriptExecutor.processBatch(CPythonScriptExecutor.java:276)
2016/07/25 10:45:21 - CPython Script Executor.0 - 	at org.pentaho.di.trans.steps.cpythonscriptexecutor.CPythonScriptExecutor.processRow(CPythonScriptExecutor.java:243)
2016/07/25 10:45:21 - CPython Script Executor.0 - 	at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
2016/07/25 10:45:21 - CPython Script Executor.0 - 	at java.lang.Thread.run(Unknown Source)
2016/07/25 10:45:21 - CPython Script Executor.0 - Finished processing (I=0, O=0, R=3, W=0, U=0, E=1)

先前的调试表明 processRow 可能无法确定元数据类型,但此错误并未表明这一点。

问题:设置脚本任务以读取 .csv 而不抛出 NullPointerExceptions 的正确方法是什么?

编辑 - 错误也与源材料一起复制。请参阅:Mark Hall、Cpython 脚本示例 .zip 文件

编辑 1 -python在命令提示符中给出

C:\Users\*****>python

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

我没有运行 anaconda(重量太重)并且我的 Python 版本提前 0.1,这可能会影响一些事情,但我希望插件与 Python 版本无关,除非Python 二进制编程接口发生更改或其他什么。

编辑 2 - 我无法附加 Kettle 文件,但上面 Mark Hall 的示例文件重现了我遇到的相同问题。

4

0 回答 0