How to access binary data (pecked data) in a row in Python Snippet

I have a table extracted from a database, which contains a colume of pecked data (binary), and this binary data represents a list of floats. 

I would like to extract each binary cell into a new column using Python snippet or anyother possible node. However, the python node does not read the binary data type, and it complains the following:

ERROR     PythonSnippetNodeModel                 types = get_column_types(csv_filename)
ERROR     PythonSnippetNodeModel               File "C:\Users\...\AppData\Local\Temp\analyze88316141627617654.py", line 77, in get_column_types
ERROR     PythonSnippetNodeModel                 itemType = row[index]
ERROR     PythonSnippetNodeModel             IndexError: list index out of range
ERROR     Python Snippet                     Execute failed: No python output table found, check script output

Is this a limitation of Python Snippet in KNIME? Or there is someother way around? Or Shall I use any other node to do the work?

Can someone help me with this? Thanks a lot!

As far as I know, the scripting nodes only support basic column types, no binary data. But this should be made clear with a column type check. I'll put it at the issue list. Thanks.

Antje

Thank you Antje!

I found an alternative way for Python snippet to process the binary data. This is what I did:

1. Use a "Binary Objcts to Files" node to save binary field into files. This will create a new field "URI" which gives the information where the files are saved.

2. Use a "URI to String" node to convert the uri format into string. Hence the Python snippet can process it.

3. Now since the binary object has been saved into file, the python snippet can directly process it from the saved location. 

Thanks,

yingwei

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