gvSIG bugs #3976
The Jython console can't be executed
Status: | Closed | % Done: | 0% | |
---|---|---|---|---|
Priority: | Normal | Spent time: | - | |
Assignee: | Joaquín del Cerro Murciano | |||
Category: | Scripting | |||
Target version: | 2.3.0-2426 (rev. org.gvsig.desktop-2.0.132, NOT USABLE) | |||
Severity: | Major | Add-on version: | ||
gvSIG version: | 2.3.0 | Add-on build: | ||
gvSIG build: | 2413 | Add-on resolve version: | ||
Operative System: | Add-on resolve build: | |||
Keywords: | Proyecto: | |||
Has patch: | Hito: | |||
Add-on name: | Unknown |
Related issues
Associated revisions
refs #3976, patch console.py to allow runing in jython 2.7.1
History
#1 Updated by Joaquín del Cerro Murciano over 8 years ago
- Related to gvSIG bugs #3975: Scripts can't be executed because of a wrong sys.path added
#2 Updated by Antonio Falciano over 8 years ago
- Target version set to 2.3.0-2447-final (rev. org.gvsig.desktop-2.0.153)
After the fix of #3975, an AttributeError occurs when executing the Jython console in build 2416:
ERROR AWT-EventQueue-0 org.gvsig.andami.messages.NotificationManager - org.gvsig.scripting.CompileErrorException: AttributeError: [...] Caused by: Traceback (most recent call last): File "<script>", line 1, in <module> File "C:\gvSIG-desktop-2.3.0-2416_x86_64\gvSIG\extensiones\org.gvsig.scripting.app.mainplugin\scripting\lib\console\console.py", line 33, in <module> class Console: File "C:\gvSIG-desktop-2.3.0-2416_x86_64\gvSIG\extensiones\org.gvsig.scripting.app.mainplugin\scripting\lib\console\console.py", line 34, in Console PROMPT = sys.ps1 AttributeError: '<reflected field public org.python.core.PyObject o' object has no attribute 'ps1'
#3 Updated by Antonio Falciano about 8 years ago
The error reported above:
AttributeError: '<reflected field public org.python.core.PyObject o' object has no attribute 'ps1'was introduced by Jython 2.7. There's an open issue about it:
https://github.com/don/jythonconsole/issues/33
Instead, trying to execute the console (jythonconsole-0.0.7) with the old Jython 2.5.3 it works fine.
#4 Updated by Antonio Falciano about 8 years ago
I get the impression that the only way to solve this issue is to downgrade again the Jython jar to 2.5.x version. It seems also that the jythonconsole version is a bit outdated (about 2006), so this one could be updated to 0.0.7: version (about 2009). The main advantage is that the code completion looks more stable.
#5 Updated by Antonio Falciano about 8 years ago
- File jython_console.png added
I've downgraded the Jython jar to 2.5.4-rc1 version and updated jythonconsole to 0.0.7 in a RC1 installation. There's only a simple fix to do in console.py (switch EXIT_ON_CLOSE to DISPOSE_ON_CLOSE at row 416) and it works fine, like in the screenshot in attachment.
#6 Updated by Antonio Falciano about 8 years ago
As stated in https://github.com/don/jythonconsole/issues/33, jythonconsole works fine until Jython 2.7-rc1. So I've replaced the Jython jar in Scripting and verified that it works also with this configuration (Jython 2.7-rc1, jythonconsole 0.0.7), so this is the best compromise we can reach at the moment.
#7 Updated by Joaquín del Cerro Murciano about 8 years ago
- Target version changed from 2.3.0-2447-final (rev. org.gvsig.desktop-2.0.153) to 2.3.0-2426 (rev. org.gvsig.desktop-2.0.132, NOT USABLE)
- Assignee set to Joaquín del Cerro Murciano
Hola Antonio,
siguiendo los enlaces que pones, al parecer sys.ps1 y sys.ps2 solo deben estar definidos en modo interactivo.
Lo que sucede es que la consola de jython es antigua y no se ha actualizado desde hace algun tiempo y no tiene en cuenta alguna de las nuevas especificaciones.
https://docs.python.org/2/library/sys.html#sys.ps1
https://hg.python.org/jython/rev/23c3effa5d4f
Voy a parchear ligeramente console.py para rodear el problema y podamos seguir trabajando con las ultimas versiones del interprete de jython.
Index: console.py =================================================================== --- console.py (revisión: 574) +++ console.py (copia de trabajo) @@ -29,6 +29,9 @@ else: print >> sys.stderr, "%s = %s" % (name, value) +if not hasattr(sys,"ps1"): + sys.ps1 ='>>> ' + sys.ps2 ='... ' class Console: PROMPT = sys.ps1
#8 Updated by Joaquín del Cerro Murciano about 8 years ago
- Related to gvSIG feature requests #4133: Downgrade the Jython standalone jar to 2.7-rc1 version added
#9 Updated by Joaquín del Cerro Murciano about 8 years ago
- Status changed from New to Fixed
#10 Updated by Antonio Falciano about 8 years ago
Hi Joaquín,
I've just verified that patching console.py solves the issue without the need to downgrade the Jython jar standalone. Thank you very much.
#11 Updated by Antonio Falciano about 8 years ago
- Status changed from Fixed to Closed