logger.debug("Executing PyTransform\n" + transformMethodStmt);
// Prepare the Python interpreter
PythonInterpreter interpreter = new PythonInterpreter();
PythonRepository repo = PythonRepository.getInstance();
repo.initializeInterperter(interpreter);
repo.importUserScripts(interpreter);
repo.compileAndAddToRepositoryAndExec(interpreter, transformMethodStmt);
Collection<Node> nodes = new ArrayList<Node>(Math.max(1000, worksheet
.getDataTable().getNumRows()));
worksheet.getDataTable().collectNodes(hNode.getHNodePath(f), nodes, selection);
Map<String, String> rowToValueMap = new HashMap<String, String>();
int counter = 0;
long starttime = System.currentTimeMillis();
// Go through all nodes collected for the column with given hNodeId
interpreter.set("workspaceid", workspace.getId());
interpreter.set("command", this);
interpreter.set("selectionName", selection.getName());
PyCode py = repo.getTransformCode();
int numRowsWithErrors = 0;
for (Node node : nodes) {
Row row = node.getBelongsToRow();
interpreter.set("nodeid", node.getId());
try {
PyObject output = interpreter.eval(py);
String transformedValue = PythonTransformationHelper
.getPyObjectValueAsString(output);
addTransformedValue(transformedRows, row, transformedValue);
} catch (PyException p) {
logger.info("error in evaluation python, skipping one row");