imagej / imagej-launcher

The ImageJ native launcher
https://imagej.net/learn/launcher
BSD 2-Clause "Simplified" License
21 stars 23 forks source link

Prevent the `UnsupportedCharsetException: cp0` when using Jython script #56

Closed LauLauThom closed 5 years ago

LauLauThom commented 5 years ago

Currently if a home made jython script/macro is saved as a plugin and executed, it runs fine but the following error message is still displayed :

console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp0.

It can be fixed by adding the following argument to the ImageJ.cfg (after Xmx****m for instance) or to the command line (for headless mode) -Dpython.console.encoding=UTF-8

It would be nice to have it as a default.

This is reported on the forum here and there

stelfrich commented 5 years ago

Do you also observe this issue on Windows 10 or is it exclusive to Windows 7?

LauLauThom commented 5 years ago

Hello Stefan, Thanks for the PR, yes I observed it on Win10, I dont have a Win7 available neither to test the PR sorry

stelfrich commented 5 years ago

yes I observed it on Win10

That's interesting. I wasn't able to reproduce the issue on my Windows 10 (32bit) VM. How exactly did you get it?

I have

  1. Created a new script via File > New > Script
  2. Set the language to Python
  3. Added print("Hello") to the script and
  4. Ran it

and did not get the exception. Hence, I couldn't confirm if #57 fixes the issue.

LauLauThom commented 5 years ago

Sorry to reopen, I can observe it with imported module (I have a 64-bit windows but I guess this does not make a difference)

So for instance put this script Test.py in jars/Lib

'''
This is Test.py script
'''
def printer(x):
    print x

and in the script editor

from Test import printer
printer("Voila")

is throwing the message for me (still printing Voila though)

imagejan commented 5 years ago

@Jindil do you also get the exception when simply running from the script editor, as outlined by @stelfrich?

  1. Created a new script via File > New > Script
  2. Set the language to Python
  3. Added print("Hello") to the script and
  4. Ran it

Note that step (3) is not necessary for me, it's sufficient to run an empty Python script to trigger the exception in the console.

See my comment on https://github.com/imagej/imagej-launcher/pull/57#issuecomment-424319338.

LauLauThom commented 5 years ago

@Jindil do you also get the exception when simply running from the script editor, as outlined by @stelfrich?

Yes I do too, but the console error shows up only once. If I close it and rerun the script then it is not opening again.

stelfrich commented 5 years ago

@Jindil You can try the latest launcher by downloading imagej-launcher-5.0.1-20180925.115628-44-win64.exe and copying this into your Fiji installation. You should then be able to start Fiji with the latest executable of the launcher.

LauLauThom commented 5 years ago

Hi guys, any chance the fix get officially released with Fiji any time soon ? I have a jython-based plugin available via an update site, the users are always a bit puzzled by the error message eventhough it is not impacting the functioning.

ctrueden commented 5 years ago

Sorry @LauLauThom, I try to be very conservative about uploading new versions of the launcher, since it will break all installations if we make a mistake. It has been on my list for a long time to post an announcement on forum.image.sc asking everyone to test the latest snapshot of the Launcher. Do you have the bandwidth to help out? We need people to test on as many platforms as possible (ideally all five).

LauLauThom commented 5 years ago

Hi Curtis, thanks for the reply. I can definitly test on Win64 and I also have a Linux installation, I have to check if 32 or 64-bit. Or is it possible to use a virtual machine in 32-bit on a 64-bit system? (maybe not the optimal to have a reliable test). For mac I can ask colleagues. For Win32 I still might have a machine that runs with it. I will be back in Germany begining of July to test all that ;) I keep you posted

LauLauThom commented 5 years ago

Hi Curtis, I tested the new Linux-64bit launcher on a machine running Lubuntu/Ubuntu 18.04.2. It works (including the cp0 encoding bug fix), there are just a few details: 1) The splash screen does not show up (works again if I put the previous launcher) 2) Running the executable from the command line I have the message Could not find X11 library, not running XInitThreads before Fiji shows up. I am wondering if I am missing something with this special Ubuntu distrib. With the previous launcher I have the usual

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
LauLauThom commented 4 years ago

I tried with a full-flavored Ubuntu 18.04.3 64-bit and I have the same behaviour

ctrueden commented 4 years ago

@LauLauThom I filed a new issue #68 to track the issues you raised.

I am pushing on new pom-scijava releases as well as component releases. As part of that I also want/need to distribute a newer launcher to everyone, to fix a variety of issues that have cropped up. But I also want to ensure things are working well.