NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 792 - Jython os.path.isdir not working anymore
Jython os.path.isdir not working anymore
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: ImageJ2
unspecified
PC Windows
: P4 major
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2014-06-16 09:19 CDT by Falk Lucas
Modified: 2014-07-14 14:59 CDT
4 users (show)

See Also:

Description Falk Lucas 2014-06-16 09:19:45 CDT
here is the error output:
Traceback (most recent call last):
  File "Untitled.py", line 9, in <module>
  File "D:\Fiji.app\jars\jython-2.5.2.jar\Lib\ntpath.py", line 270, in isdir
  File "D:\Fiji.app\jars\jython-2.5.2.jar\Lib\ntpath.py", line 270, in isdir
java.lang.IncompatibleClassChangeError: Found class com.kenai.jffi.InvocationBuffer, but interface was expected

	at com.kenai.jaffl.provider.jffi.AsmRuntime.marshal(AsmRuntime.java:167)

	at org.python.posix.WindowsLibC$jaffl$0.stat$raw(Unknown Source)

	at org.python.posix.WindowsLibC$jaffl$0.stat(Unknown Source)

	at org.python.posix.BaseNativePOSIX.stat(BaseNativePOSIX.java:200)

	at org.python.posix.LazyPOSIX.stat(LazyPOSIX.java:207)

	at org.python.modules.posix.PosixModule$StatFunction.__call__(PosixModule.java:966)

	at ntpath$py.isdir$17(D:\Fiji.app\jars\jython-2.5.2.jar\Lib\ntpath.py:273)

	at ntpath$py.call_function(D:\Fiji.app\jars\jython-2.5.2.jar\Lib\ntpath.py)

	at org.python.core.PyTableCode.call(PyTableCode.java:165)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:134)

	at org.python.core.PyFunction.__call__(PyFunction.java:317)

	at org.python.pycode._pyx3.f$0(Untitled.py:17)

	at org.python.pycode._pyx3.call_function(Untitled.py)

	at org.python.core.PyTableCode.call(PyTableCode.java:165)

	at org.python.core.PyCode.call(PyCode.java:18)

	at org.python.core.Py.runCode(Py.java:1261)

	at org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76)

	at org.scijava.script.ScriptModule.run(ScriptModule.java:172)

	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)

	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)

	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)

	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

	at java.util.concurrent.FutureTask.run(FutureTask.java:138)

	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

	at java.lang.Thread.run(Thread.java:619)


java.lang.IncompatibleClassChangeError: java.lang.IncompatibleClassChangeError: Found class com.kenai.jffi.InvocationBuffer, but interface was expected

	at org.python.core.PyException.fillInStackTrace(PyException.java:70)
	at java.lang.Throwable.<init>(Throwable.java:181)
	at java.lang.Exception.<init>(Exception.java:29)
	at java.lang.RuntimeException.<init>(RuntimeException.java:32)
	at org.python.core.PyException.<init>(PyException.java:46)
	at org.python.core.PyException.<init>(PyException.java:43)
	at org.python.core.Py.JavaError(Py.java:481)
	at org.python.core.Py.setException(Py.java:1204)
	at ntpath$py.isdir$17(D:\Fiji.app\jars\jython-2.5.2.jar\Lib\ntpath.py:273)
	at ntpath$py.call_function(D:\Fiji.app\jars\jython-2.5.2.jar\Lib\ntpath.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
	at org.python.core.PyFunction.__call__(PyFunction.java:317)
	at org.python.pycode._pyx3.f$0(Untitled.py:17)
	at org.python.pycode._pyx3.call_function(Untitled.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1261)
	at org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:172)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IncompatibleClassChangeError: Found class com.kenai.jffi.InvocationBuffer, but interface was expected
	at com.kenai.jaffl.provider.jffi.AsmRuntime.marshal(AsmRuntime.java:167)
	at org.python.posix.WindowsLibC$jaffl$0.stat$raw(Unknown Source)
	at org.python.posix.WindowsLibC$jaffl$0.stat(Unknown Source)
	at org.python.posix.BaseNativePOSIX.stat(BaseNativePOSIX.java:200)
	at org.python.posix.LazyPOSIX.stat(LazyPOSIX.java:207)
	at org.python.modules.posix.PosixModule$StatFunction.__call__(PosixModule.java:966)
	... 20 more

Information about your version of Java:

  os.arch => amd64
  os.name => Windows 7
  os.version => 6.1
  java.version => 1.6.0_20
  java.vendor => Sun Microsystems Inc.
  java.runtime.name => Java(TM) SE Runtime Environment
  java.runtime.version => 1.6.0_20-b02
  java.vm.name => Java HotSpot(TM) 64-Bit Server VM
  java.vm.version => 16.3-b01
  java.vm.vendor => Sun Microsystems Inc.
  java.vm.info => mixed mode
  java.awt.graphicsenv => sun.awt.Win32GraphicsEnvironment
  java.specification.name => Java Platform API Specification
  java.specification.version => 1.6
  sun.cpu.endian => little
  sun.desktop => windows
  file.separator => \

The up-to-date check says: REMIND_LATER

Information relevant to JAVA_HOME related problems:

  JAVA_HOME is set to: D:\Fiji.app/java/win64/jdk1.6.0_20//jre
  imagej.dir => D:\Fiji.app

Information about the version of each plugin:

Activated update sites:
ImageJ: http://update.imagej.net/ (last check:20140616153006)
Fiji: http://fiji.sc/update/ (last check:20140612230314)

Files not up-to-date:
  9cf5f8c5 (LOCAL_ONLY) 20101122152004 macros/AddZeros.ijm
  924708a7 (LOCAL_ONLY) 20101122151547 macros/Batch_FindMag.ijm
  510dc392 (LOCAL_ONLY) 20120130151227 macros/CreateFileListHelios2_.ijm
  a6a918d7 (LOCAL_ONLY) 20110127110544 macros/CreateFileListTXT.ijm
  a9f2c8d8 (LOCAL_ONLY) 20101123103018 macros/FindMag_New.ijm
  59a9dfb8 (LOCAL_ONLY) 20100602102203 macros/KeenView_PixelSize.txt
  6ebedb20 (LOCAL_ONLY) 20101122115945 macros/MacroExt.ijm
  140d0957 (LOCAL_ONLY) 20100602095206 macros/MegaView_PixelSize.txt
  9c9e4176 (LOCAL_ONLY) 20101123114420 macros/MosaicMorghani.ijm
  feffea10 (LOCAL_ONLY) 20101118104325 macros/PixelSize_KeenView.txt
  6756bf17 (LOCAL_ONLY) 20101118101953 macros/PixelSize_MegaView.txt
  c4649978 (LOCAL_ONLY) 20101122151951 macros/RenameMia.ijm
  dd974de2 (LOCAL_ONLY) 20101119093122 macros/RenameMia.txt
  667a30b0 (LOCAL_ONLY) 20101118162051 macros/TestArgument_.ijm
  cd933dc2 (LOCAL_ONLY) 20140318144817 macros/falk_.ijm
  0b412ee7 (LOCAL_ONLY) 20101123114304 macros/myTool.txt
  f07ea19d (LOCAL_ONLY) 20130507122737 macros/test.txt
  1455d44a (LOCAL_ONLY) 20111104141853 macros/toolsets/EMEZ Tools.ijm
  d60d1942 (LOCAL_ONLY) 20111104141934 macros/toolsets/EMEZ Tools2.ijm
  33c6c457 (LOCAL_ONLY) 20130604133657 macros/toolsets/Falk's Toolset.txt
  bb3b18aa (LOCAL_ONLY) 20130604133640 macros/toolsets/IJ.txt
  b8355a05 (LOCAL_ONLY) 20100601103313 macros/toolsets/IconTools.ijm
  ddcaf60f (LOCAL_ONLY) 20130604133930 macros/toolsets/MacroDev.txt
  e9cb6eb7 (LOCAL_ONLY) 20121210155405 plugins/Image_CorrelationJ_1o.class
  8e243042 (LOCAL_ONLY) 20140117093038 plugins/SCS_Semiautomated_Segmentation.jar
  6e155e63 (NOT_INSTALLED) 20101208111418 plugins/Samples_.jar
  36f3e680 (LOCAL_ONLY) 20140318150746 scripts/New_.py
  d3260180 (LOCAL_ONLY) 20100909153741 scripts/Record_Desktop.py
  0ea7f8fc (LOCAL_ONLY) 20100909153741 scripts/Record_Window.py
Comment 1 Johannes Schindelin 2014-06-16 11:20:23 CDT
I appreciate that you tried to categorize the problem, but I fear that it is not quite correct.

We tried to address this problem both in the launcher and in the ij1-patcher which makes me wonder whether you would be able to give a detailed description how you call this Python script? There are about five ways I can think of, but only one of them that might be able to produce such a trace. I am unfortunately too scarce on time (also because I write clarifying comments to the bug tracker, such as this one, between fixing all those bugs) to go on a wild goose hunt to figure out whether I can guess the correct way to start a Python script to reproduce your error, and even if I could, my fix would not necessarily fix your problem.

So I really have to ask you for your assistance to make your problem easier to reproduce.
Comment 2 Falk Lucas 2014-06-16 12:59:51 CDT
Hi,
I'm using the built in script editor to run my scripts. 
os.path.isdir - I just tried today I have to say.
just downloaded the "old" version from before ij2, which returns the same error at least on a MAC OSX
what I wanted to do is looping thru one directory and find all sub directories.
Comment 3 Curtis Rueden 2014-06-16 15:41:22 CDT
I can confirm that I see the same error in a fully updated Fiji when running the following script in the Script Editor:

 import os
 print os.path.isdir("/")
Comment 4 Johannes Schindelin 2014-06-17 17:20:19 CDT
Falk, you might want to follow Curtis' example in the future: he gave me a very easy and quick way to reproduce the problem. That allowed me to fix the bug quickly, by switching JRuby from the "complete" package to finer-grained, more up-to-date components that no longer conflict with Jython.

Committed, deployed and uploaded.
Comment 5 Aryeh Weiss 2014-06-25 05:19:16 CDT
This bug reappeared today on our latest Fiji install.
We found that trackmate-dev installs ruby files.
Therefore we again deselected the trackmate update site.

This remark should probably be cross-referenced to the thread about
add on site interactions. Is there a simple way to do that?
Comment 6 Johannes Schindelin 2014-06-25 11:30:41 CDT
> We found that trackmate-dev installs ruby files.

Thank you for reporting this bug! It is technically another bug because it affected the TrackMate-dev site and therefore required a different fix... ;-)

But I marked jruby-complete.jar as obsolete on the TrackMate-dev site and everything should be groovy again.
Comment 7 Aryeh Weiss 2014-06-25 13:08:37 CDT
Thank you. I will test it when I am next in that lab (should be Sunday or Monday).
Comment 8 Johannes Schindelin 2014-07-10 11:14:09 CDT
Aaargh. I know that we should set up bugzilla@fiji.sc to attach new comments to this Bugzilla, but who donates me the time I need to do that?

This is what even I sent to the mailing list:

On Thu, 10 Jul 2014, fcollman wrote:

> To add to Michael's report, I get the same behavior, but on an
> up-to-date version of FIJI freshly downloaded and updated today,
> deleting the jruby-complete.jar no longer restores this functionality as
> it had for me in the past.

Please provide the console output. To see how to produce it, please look
at http://fiji.sc/Command-Line_Debugging
Comment 9 Johannes Schindelin 2014-07-10 11:14:58 CDT
I should also note that it would be better to open *another* bug report because the original bug actually has been squashed, it just looks as if the symptom of the new bug is similar to the fixed bug's.
Comment 10 Johannes Schindelin 2014-07-11 14:15:15 CDT
Please note that replying by mail does *not* update the issue on Bugzilla. Please refrain from the temptation to reply to the mail sent to the Fiji mailing list and post your comments on http://fiji.sc/bugzilla/﷒0﷓ instead.

On Fri, 11 Jul 2014, Michael Majurski wrote:

> I am not including the console output from starting up Fiji, because I am 
> unsure if it is relevant, as well as the fact that it generates a great 
> deal of content that would just obfuscate the post.

The answer is yes, the output is relevant.

> Script run: 
> saved on the desktop as "temp.py", run by opening it in the script editor 
> within Fiji and pressing the run button.
> "import os
> print os.path.isdir('/')"
>  
> 
> > Console output:
> >
> "
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         progress = -1
>         maximum = -1
>         status = Running command: script:C:\Users\mmajursk\Desktop\temp.py
>         warning = false,null,null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461,null,null), called 
> from
>  non-EDT Thread:null
> [DEBUG] Executing module: org.scijava.script.ScriptModule@a530461
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.module.process.DebugPreprocessor@1073f623,null,n
> ull), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.module.process.ValidityPreprocessor@7b1ebc46,nul
> l,null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = org.scijava.ui.UIPreprocessor@1edad6d0,null,null), 
> called fr
> om non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.display.ActiveDisplayPreprocessor@314d0183,null,
> null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.module.process.GatewayPreprocessor@55d43df5,null
> ,null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.module.process.ServicePreprocessor@612fcbd8,null
> ,null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> net.imagej.display.ActiveImagePreprocessor@8f003c1,null,null
> ), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> net.imagej.legacy.plugin.ActiveImagePlusPreprocessor@4586787
> c,null,null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.module.process.InitPreprocessor@7f50388c,null,nu
> ll), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.module.process.LoadInputsPreprocessor@6bb0b0a0,n
> ull,null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = org.scijava.ui.FilePreprocessor@1d1c0f9c,null,null), 
> called
> from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.ui.awt.widget.AWTInputHarvester@1d44d9b2,null,nu
> ll), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.ui.swing.widget.SwingInputHarvester@45c8dc5e,nul
> l,null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.ui.swing.widget.SwingMdiInputHarvester@5fbc31d,n
> ull,null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> net.imagej.legacy.ui.LegacyInputHarvester@53c6a7fc,null,null
> ), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.module.process.CheckInputsPreprocessor@173ebc5c,
> null,null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.module.process.SaveInputsPreprocessor@17c047f0,n
> ull,null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461,null,null), called 
> from
>  non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461,null,null), called 
> from
>  non-EDT Thread:null
> [DEBUG] INPUTS:
> [DEBUG] OUTPUTS:
> [DEBUG]         result = null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.module.process.DebugPostprocessor@7fa3eaa8,null,
> null), called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461
>         processor = 
> org.scijava.display.DisplayPostprocessor@6282fd0f,null,null)
> , called from non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         module = org.scijava.script.ScriptModule@a530461,null,null), called 
> from
>  non-EDT Thread:null
> [DEBUG] publish(
>         context = org.scijava.Context@1b845568
>         consumed = false
>         progress = -1
>         maximum = -1
>         status = Command finished: script:C:\Users\mmajursk\Desktop\temp.py
>         warning = false,null,null), called from non-EDT Thread:null
> "
>  
> Hope that helps

Unfortunately, this does not help because the exception that is undoubtedly thrown is not shown in the console.

You should see an exception in the error window of the script editor, though.

I should point out, though, that I was *not* joking when I humbly requested opening a new bug report. It is hard enough to keep up with the pace of bug fixes we are performing these days, any little help you can provide to make it easier on us is appreciated.
Comment 11 Curtis Rueden 2014-07-14 14:59:04 CDT
For those who have similar problems and find this bug report: see also http://fiji.sc/bugzilla/﷒0﷓ and https://github.com/fiji/fiji/issues/83.