Python scripts works outside KNIME but not inside Python Script Node (1->1)

Hi guys,

I have python script that runs fine outside KNIME. It uses python-bioformats to read image metadata to create a z-surface of the image sample to check focus issues. Now my idea was to transfer this to KNIME to do more analysis and create reports. But when I try to run the script it throw error messages.

I suspect that has something to do with the javabridge used by python-bioformats but I am not an expert here. The relevant part of the script is here:

import sys
import bfimage as bf
import dispZsurface as dsp
import pandas as pd
import matplotlib.pyplot as plt

filenameczi = input_table['czifilename'][0]
print'Selected CZI File: ', filenameczi
# create plane info from CZI image file and write CSV file (optional)
planetable, filenamecsv = bf.get_planetable(filenameczi, writecsv=False, separator='\t')
# show the dataframe
print planetable[:10]
print planetable.shape[0]

And the error message is here:

Selected CZI File:  s:\Python_Projects_Testdata\CZI\testwell96.czi
Failed to get class loci/common/RandomAccessInputStream
Problem retrieving Java Metadata Store or Series size: <class 'javabridge.jutil.JavaException'>

Traceback (most recent call last):
  File "C:\Program Files\KNIME\plugins\org.knime.python_3.3.0.v201611242050\py\", line 282, in execute
    exec(source_code, _exec_env, _exec_env)
  File "<string>", line 12, in <module>
  File "c:\Users\Sebastian\Documents\GitHub\BioFormatsRead\bfimage\", line 383, in get_planetable
    jmd, MetaInfo['TotalSeries'], MetaInfo['ImageIDs'], series_dimension, multires = get_java_metadata_store(imagefile)
  File "c:\Users\Sebastian\Documents\GitHub\BioFormatsRead\bfimage\", line 126, in get_java_metadata_store
    rdr = bioformats.get_image_reader(None, path=imagefile)
  File "C:\Anaconda2\lib\site-packages\bioformats\", line 945, in get_image_reader
    rdr = ImageReader(path=path, url=url)
  File "C:\Anaconda2\lib\site-packages\bioformats\", line 638, in __init__
  File "C:\Anaconda2\lib\site-packages\javabridge\", line 1713, in make_instance
    raise JavaException(jexception)
JavaException: loci/common/RandomAccessInputStream

Any idea how to solve this issue?



Hi Sebi,

Thanks for reporting this. The problem seems to be in in the python process and potentially is unrelated to KNIME itself. However, if you could provide us with a small example workflow, input data and the links of the packages and repositories we have to install and checkout then we will try to reproduce the problem locally and see whats going on.

Sorry for the trouble,