Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent the UnsupportedCharsetException: cp0 when using Jython script #56

Closed
LauLauThom opened this issue Sep 14, 2018 · 13 comments · Fixed by #57
Closed

Prevent the UnsupportedCharsetException: cp0 when using Jython script #56

LauLauThom opened this issue Sep 14, 2018 · 13 comments · Fixed by #57

Comments

@LauLauThom
Copy link

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
Copy link
Member

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

@LauLauThom
Copy link
Author

LauLauThom commented Sep 25, 2018

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

imagejan commented Sep 25, 2018

@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 #57 (comment).

@imagejan imagejan reopened this Sep 25, 2018
@LauLauThom
Copy link
Author

LauLauThom commented Sep 25, 2018

@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
Copy link
Member

@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
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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
Copy link
Author

LauLauThom commented Jul 5, 2019

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
Copy link
Author

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

@ctrueden
Copy link
Member

ctrueden commented Oct 9, 2019

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants