|
From: <yaq...@gm...> - 2016-01-09 04:12:37
|
Jim,
I am trying to solve the problem from source code of Jython. I think all 'new PyString(str)' and 'Py.newString(str) functions should be replaced by 'Py.newStringOrUnicode(str)' function. But it seems 'PyObject.java' content can not be changed. For example, I changed
public PyObject __finditem__(String key) {
return __finditem__(new PyString(key));
}
to
public PyObject __finditem__(String key) {
return __finditem__(Py.newStringOrUnicode(key));
}
But after source code building the content of 'PyObject.java' was changed automaticlly to original content. How to solve it?
Regards
Yaqiang
*************************************************
Dr. Yaqiang Wang
Chinese Academy of Meteorological Sciences (CAMS)
46, Zhong-Guan-Cun South Avenue
Beijing, 100081
China
yaq...@gm...
http://www.meteothinker.com
https://www.researchgate.net/profile/Yaqiang_Wang5
**************************************************
From: Jim Baker
Date: 2016-01-09 11:36
To: yaq...@gm...
CC: jython-users; Jython Developers
Subject: Re: Re: [Jython-users] How to build Jython standalone jar from source code
Yaqiang,
I believe that bug was fixed related to sockets was most likely fixed, but we have other issues where Java is using Unicode, but Python wants a str (which is just bytes). So we see it in the somewhat related bugs http://bugs.jython.org/issue2369 and http://bugs.jython.org/issue2293 (possibly others).
I think the only way we are going to solve this problem is for one of us developers to attempt to do everything using a username/home directory that does not use ascii. Otherwise we are just doing piecemeal fixes.
- Jim
On Fri, Jan 8, 2016 at 8:06 PM, yaq...@gm... <yaq...@gm...> wrote:
Dear jim,
I have built Jython standalone jar for version 2.7.1b2 succesfully using 'ant all-jars' command with Java 7. But I still have below problem with newest Jython version.
I am developing MeteoInfoLab software using Java and Jython (as script language). It's ok to initialize Jython when the directory path only includes ASCII characters. But the initialization will be failed if the path includes non-ASCII characters (in my case is Chinese characters). The error message shows: java.lang.IllegalArgumentException: Cannot create PyString with non-byte value. The issue 2331 said it has been solved in 2.7.1b2 (http://bugs.jython.org/issue2331) , but the problem is still there from my test. I also mentioned that a comment report same problem in github (https://github.com/jythontools/jython/commit/c61eaefb774cdb174472265d3c27fc5b87febd34).
The detailed error message:
java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
at org.python.core.PyString.<init>(PyString.java:64)
at org.python.core.PyString.<init>(PyString.java:70)
at org.python.core.Py.newString(Py.java:645)
at org.python.core.PySystemState.initRegistry(PySystemState.java:795)
at org.python.core.PySystemState.doInitialize(PySystemState.java:1040)
at org.python.core.PySystemState.initialize(PySystemState.java:969)
at org.python.core.PySystemState.initialize(PySystemState.java:925)
at org.python.core.PySystemState.initialize(PySystemState.java:920)
at org.python.core.PySystemState.initialize(PySystemState.java:915)
at org.python.core.PySystemState.initialize(PySystemState.java:911)
at org.python.core.ThreadStateMapping.getThreadState(ThreadStateMapping.java:32)
at org.python.core.Py.getThreadState(Py.java:1457)
at org.python.core.Py.getThreadState(Py.java:1453)
at org.python.core.Py.getSystemState(Py.java:1473)
at org.meteoinfo.laboratory.gui.ConsoleDockable.initializeConsole(ConsoleDockable.java:65)
at org.meteoinfo.laboratory.gui.ConsoleDockable.<init>(ConsoleDockable.java:47)
at org.meteoinfo.laboratory.gui.FrmMain.<init>(FrmMain.java:143)
at org.meteoinfo.laboratory.MeteoInfoLab$1.run(MeteoInfoLab.java:264)
Regards
Yaqiang
*************************************************
Dr. Yaqiang Wang
Chinese Academy of Meteorological Sciences (CAMS)
46, Zhong-Guan-Cun South Avenue
Beijing, 100081
China
yaq...@gm...
http://www.meteothinker.com
https://www.researchgate.net/profile/Yaqiang_Wang5
**************************************************
From: Jim Baker
Date: 2016-01-09 10:10
To: yaq...@gm...
CC: jython-users
Subject: Re: [Jython-users] How to build Jython standalone jar from source code
Yaqiang,
Check out the source from https://hg.python.org/jython or the mirror at https://github.com/jythontools/jython
You can build from source by using this ant target:
all all-jars
The standalone jar is in dist/jython-standalone.jar
Please note that due to the use of an older version of Antlr, building is only currently supported on Java 7; but built jars will run on Java 7, 8, or 9. (Taking into account this limitation with Java 9: http://bugs.jython.org/issue2362)
Hope this helps!
- Jim
On Fri, Jan 8, 2016 at 7:02 PM, yaq...@gm... <yaq...@gm...> wrote:
How to build Jython standalone jar from source code? Any help is appreciated.
Regrads
Yaqiang
*************************************************
Dr. Yaqiang Wang
Chinese Academy of Meteorological Sciences (CAMS)
46, Zhong-Guan-Cun South Avenue
Beijing, 100081
China
yaq...@gm...
http://www.meteothinker.com
https://www.researchgate.net/profile/Yaqiang_Wang5
**************************************************
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Jython-users mailing list
Jyt...@li...
https://lists.sourceforge.net/lists/listinfo/jython-users
|