python-bioformats
python-bioformats copied to clipboard
Unclear problem with bioformats.get_omexml_metadata
Hi guys,
I just cannot figure out what causes the problem shiwn below. Any ideas?
Sebi
Python 2.7.11 |Anaconda 2.4.1 (64-bit)| (default, Jan 29 2016, 14:26:21) [MSC v.1500 64 bit (AMD64)] on win32
In[2]: import bioformats
In[3]: filename = r'c:\Users\M1SRH\Documents\Spyder_Projects_Testdata\CZI_Read\2x2_SNAP_CH=2_Z=5.czi'
In[4]: omexml = bioformats.get_omexml_metadata(filename)
Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 3066, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "
It's failing at the point where javabridge tries to access the loci.common.RandomAccessInputStream class. Most likely the bioformats jar isn't on the classpath. The following will tell you:
import javabridge
import bioformats
import os
javabridge.start_vm(class_path=bioformats.JARS)
classpath = javabridge.JClassWrapper('java.lang.System').getProperty('java.class.path')
for path in classpath.split(os.pathsep):
print ("exists: " if os.path.isfile(path) else "missing: ") + path
exists: c:\Python27\lib\site-packages\javabridge-1.0.11_21_g881902f-py2.7-win-amd64.egg\javabridge\jars\rhino-1.7R4.jar
exists: c:\Python27\lib\site-packages\javabridge-1.0.11_21_g881902f-py2.7-win-amd64.egg\javabridge\jars\runnablequeue.jar
exists: c:\Python27\lib\site-packages\javabridge-1.0.11_21_g881902f-py2.7-win-amd64.egg\javabridge\jars\cpython.jar
exists: c:\users\leek\cpdev\python-bioformats\python-bioformats\bioformats\jars\loci_tools.jar
I was running into this problem and tried the code above and javabridge was on the classpath. later realized that I was trying to run the bioformats.get_image_reader after running the javabridge.kill_vm(). which produced the error above. Adding this in case anybody gets this problem.
also for the code above the print statement should be in parenthesis for 3.x print (("exists: " if os.path.isfile(path) else "missing: ") + path)