My ultimate goal is to convert a running Python project into a Jython interpreter, because some java APIs will be added.
Details:
- Latest Jython - 2.7
- The project that I have can be started using Python 3.5
So, I applied the following approach:
First of all, I had to convert my project to Python 2.7 using the future module and pasteurize the executable file. This step has been completed successfully.
Secondly, you need to convert your Python 2.7 project to a Jython 2.7 project. The following error was reported when switching the interpreter to Mars Eclipse:
console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp0.
To get around this, the solution from this post was used by passing the encoding argument -Dpython.console.encoding=UTF-8 to the Java virtual machine as shown in the figure below: 
Thumbs up when trying to start again. But, unfortunately, an error appeared here, shown below. Since I do not plan to change any imported module, if there is no need to do this, I decided to seek help here.
pydev debugger: starting (pid: 4216) Traceback (most recent call last): File "C:\Users\souzadan\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\pydevd.py", line 2364, in <module> globals = debugger.run(setup['file'], None, None, is_module) File "C:\Users\souzadan\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\pydevd.py", line 1784, in run pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Users\souzadan\FirmwareDevTools\Workspaces\Eclipse\aPythonWorkspace\aPythonProject\aPythonFolder\aPythonFile.py", line 7, in <module> standard_library.install_aliases() File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\site-packages\future-0.15.2-py2.7.egg\future\standard_library\__init__.py", line 465, in install_aliases from future.backports.urllib import request File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\site-packages\future-0.15.2-py2.7.egg\future\backports\urllib\request.py", line 96, in <module> from future.backports import email File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\site-packages\future-0.15.2-py2.7.egg\future\backports\email\__init__.py", line 16, in <module> from future.utils import surrogateescape File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\site-packages\future-0.15.2-py2.7.egg\future\utils\surrogateescape.py", line 167, in <module> FS_ENCODING = 'ascii'; fn = b('[abc\xff]'); encoded = u('[abc\udcff]') File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\site-packages\future-0.15.2-py2.7.egg\future\utils\surrogateescape.py", line 25, in u return text.decode('unicode_escape') UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 4-10: illegal Unicode character Error in atexit._run_exitfuncs: Traceback (most recent call last): File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\threading.py", line 297, in _MainThread__exitfunc t.join() File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\threading.py", line 128, in join raise RuntimeError("cannot join current thread") RuntimeError: cannot join current thread Error in sys.exitfunc: Traceback (most recent call last): File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\threading.py", line 297, in _MainThread__exitfunc t.join() File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\threading.py", line 128, in join raise RuntimeError("cannot join current thread") RuntimeError: cannot join current thread
Running Jython through the command line reduces the error log:
Traceback (most recent call last): File "somePythonCode.py", line 7, in <module> standard_library.install_aliases() File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\site-packages\future-0.15.2-py2.7.egg\future\standard_library\__init__.py", line 465, in install_aliases from future.backports.urllib import request File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\site-packages\future-0.15.2-py2.7.egg\future\backports\urllib\request.py", line 96, in <module> from future.backports import email File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\site-packages\future-0.15.2-py2.7.egg\future\backports\email\__init__.py", line 16, in <module> from future.utils import surrogateescape File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\site-packages\future-0.15.2-py2.7.egg\future\utils\surrogateescape.py", line 167, in <module> FS_ENCODING = 'ascii'; fn = b('[abc\xff]'); encoded = u('[abc\udcff]') File "C:\Users\souzadan\FirmwareDevTools\Compilers\Jython2.7.0\Lib\site-packages\future-0.15.2-py2.7.egg\future\utils\surrogateescape.py", line 25, in u return text.decode('unicode_escape') UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 4-10: illegal Unicode character
Does anyone know how to solve this error in the most elegant way?
A bug was created on Jython.org with serious seriousness, because many people already use the latest Python modules and interpreters. And they may want to add Java functionality to their code. Therefore, they basically would have to follow the same path as me. Then transferring the project back to Python 2.7, then to Jython 2.7.
In python-future, a function error was logged.