# knime crashes after a custom python script return a rdkit mol object

**URL:** <https://forum.knime.com/t/knime-crashes-after-a-custom-python-script-return-a-rdkit-mol-object/71260>\
**Category:** Community Extensions\
**Tags:** rdkit\
**Created:** [July 31, 2023, 8:11am UTC](https://forum.knime.com/t/knime-crashes-after-a-custom-python-script-return-a-rdkit-mol-object/71260 "2023-07-31T08:11:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![likhangy](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/l/3da27b/32.png) [@likhangy](https://forum.knime.com/u/likhangy)\
**Post date:** [July 31, 2023, 8:11am UTC](https://forum.knime.com/t/knime-crashes-after-a-custom-python-script-return-a-rdkit-mol-object/71260/1 "2023-07-31T08:11:32Z")

</div>

Hello all,

I just started using knime (version 5.1.0) with rdkit in Windows and I am having an issue I couldn’t figure out.

I wrote the following cutom python function using rdkit:

The function will cause knime to crash and exit after execution. However, if I add a line to convert the mol object back to string, it will execute successfully (see the example below).

I think this might be a bug, but I am still new to knime so I can’t be sure.

Lik

```auto
import knime.scripting.io as knio
from rdkit.Chem import rdDeprotect
from rdkit import Chem

input_table = knio.input_tables[0].to_pandas()

# deprotect molecules
mol=list(input_table['smiles (RDKit Mol)'])
mol_deprotect=[rdDeprotect.Deprotect(x) for x in mol] #this will fail when execute
# this will run successfully: mol_deprotect=[Chem.MolToSmiles(rdDeprotect.Deprotect(x)) for x in mol]

input_table['deprotected_mol']=mol_deprotect

# TODO: work with the pandas.DataFrame here...
output_table = input_table

# Populate the first output table of the node (use knio.output_tables[1] to populate the second one, etc.).
knio.output_tables[0] = knio.Table.from_pandas(output_table)

```

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [October 29, 2023, 8:11am UTC](https://forum.knime.com/t/knime-crashes-after-a-custom-python-script-return-a-rdkit-mol-object/71260/2 "2023-10-29T08:11:36Z")

</div>

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