After fiji update, scripts don't work right

I’m learning Fiji scripting by Python(Jython).
A week ago, I updated my fiji app and after that the scripts I wrote don’t work right.

Here is the error message I got.

java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
at org.python.core.PyString.(
at org.python.core.PyString.(
at org.python.core.PyString.(
at org.python.core.Py.newString(
at org.python.jsr223.PyScriptEngine.compileScript(
at org.python.jsr223.PyScriptEngine.eval(
at javax.script.AbstractScriptEngine.eval(
at org.scijava.thread.DefaultThreadService.lambda$wrap$2(
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$

I googled and found that if I use full width characters such as Chinese and Japanese the error shows up.
But in my case, I didn’t use those characters and the scripts work just right if I open a new script and copy paste the original code and run it.
This is the case with all the scripts I wrote so it’s not the problem of each code.

Mac OSX 10.14.6
Fiji imagej ver1.52p

Could anyone solve this problem?

1 Like

Hi @shime,

Welcome to the forum.

We’ll be able to help you more effectively if you post an example script that produces this error.
(Ideally the smallest script that causes the error)


1 Like

Hi bogovicj,

Here is the script.

from ij import IJ

imp = IJ.getImage()
ip = imp.getProcessor()

print imp
print ip

What is the title (name) of the image?

The title is “sample.png”.

Hey @shime

would you mind testing if this also happens with a freshly downloaded Fiji?


1 Like

Hi @haesleinhuepf
I installed freshly downloaded Fiji but still the error occurs.
After starting new Fiji for the first time, a popup showed up and recommended me to
update Fiji, so I tried both skipping the update and executing the update.
However, the error occurs in both cases.
What is weird is it works just right if I open a new script and copy paste the
whole code to the new script.

Would you mind sharing a functional and a non-functional script? Packed as a zip file? I suspect some charset issue…

1 Like

Please include an image as well

Hi @haesleinhuepf
I installed the older version of Fiji (2017 May 30) and it worked fine!
For the functional and a non-functional script, I’m not sure what they exactly are.
Could you give me more information? I’m new to programming and English is
my second language.

Hi @bogovicj

Here is the image I used.

You said a script doesn’t work anymore (not functional) but after copy-paste it does work (functional). We might need these two files. Ideally as a compressed ZIP archive file.

I found that even though the newly opened script works, it stops working once it is saved. This is the case with the latest version of Fiji. If I use the older version, it works.

1 Like

In case you might need the (1.4 KB)

1 Like

Hello shime -

Just one data point:

I do not get an error running your script on
ImageJ 2.0.0-rc-69/1.52r55, running on ubuntu 16.04 LTS.

I downloaded your “sample.png” image and your “”
I opened the image and opened “” in the script
editor, and ran it without issue. (I also tried saving the script
and reopening it. The reopened script also ran without issue.)

Thanks, mm

1 Like

Hi @mountain_man

Thank you for testing. I might have found the problem.


I found that if the path of the script contains full-width character, the error occurs.
It seems the latest version of Fiji can’t handle full-width character in script’s path while the older version can do that. The path of the image doesn’t matter. The latest version can handle images the path of which contain full-width characters.
But, it can be true only on my computer so I would be glad if you could examine it.
There is also a chance that the problem occurs only for Japanese.
I’m not familiar with those charset or encoding things.


Thanks for reporting your findings.

For the record, there’s an open issue on the jython/jython repository here:

Might be totally unrelated, but I also have issues with using file paths with the latest Fiji.