gvSIG bugs #3975

Scripts can't be executed because of a wrong sys.path

Added by Antonio Falciano over 8 years ago. Updated over 8 years ago.

Status:Closed% Done:

0%

Priority:HighSpent time:-
Assignee:Joaquín del Cerro Murciano
Category:Scripting
Target version:2.3.0-2416 (rev. org.gvsig.desktop-2.0.122)
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

Description

The scripts can't be executed because the site module is not found. It seems that the issue is due to a wrong sys.path where the gvSIG folder is considered two times:

ImportError: Cannot import site module and its dependencies: No module named site
Determine if the following attributes are correct:
  * sys.path: ['C:\\gvSIG-desktop-2.3.0-2413_x86_64\\:\\gvSIG-desktop-2.3.0-2413_x86_64\\gvSIG\\extensiones\\org.gvsig.scripting.app.mainplugin\\lib\\Lib', '__classpath__', '__pyclasspath__/']
    This attribute might be including the wrong directories, such as from CPython
  * sys.prefix: C:\gvSIG-desktop-2.3.0-2413_x86_64\:\gvSIG-desktop-2.3.0-2413_x86_64\gvSIG\extensiones\org.gvsig.scripting.app.mainplugin\lib
    This attribute is set by the system property python.home, although it can
    be often automatically determined by the location of the Jython jar file

You can use the -S option or python.import.site=false to not import the site module


Related issues

Related to Application: gvSIG desktop - gvSIG bugs #3976: The Jython console can't be executed Closed 01/02/2016

Associated revisions

Revision 42649
Added by Joaquín del Cerro Murciano over 8 years ago

refs #3975, añadido codigo para que los autorun.sh de los plugins puedan especificar properties de java

Revision 524
Added by Joaquín del Cerro Murciano over 8 years ago

refs #3975, añadida la inicializacion de "python.home" ya que en windows no es capaz de encontrarlo de forma automatica.

History

#1 Updated by Joaquín del Cerro Murciano over 8 years ago

  • Target version set to 2.3.0-2416 (rev. org.gvsig.desktop-2.0.122)
  • Priority changed from Normal to High
  • Assignee set to Joaquín del Cerro Murciano

#2 Updated by Joaquín del Cerro Murciano over 8 years ago

#4 Updated by Joaquín del Cerro Murciano over 8 years ago

Ademas de ese error en mi sistema tambien estaba fallando por que no podia escribir en la carpeta cachedir:

*sys-package-mgr*: can't create package cache dir, 'c:\devel\gvSIG-desktop\gvSIG-desktop-2.3.0-2314\:\devel\gvSIG-desktop\gvSIG-desktop-2.3.0-2314\gvSIG\extensiones\org.gvsig.scripting.app.mainplugin\lib\cachedir\packages'
 INFO [AWT-EventQueue-0] (DefaultJScriptingComposer.java:1327) - Can't execute dialog-
ImportError: Cannot import site module and its dependencies: No module named site
Determine if the following attributes are correct:

He añadido codigo para que el cachedir lo genere en la carpeta del usuario (gvSIG/plugins/org.gvsig.scripting.app.mainplugin/python.cachedir).

El error de:

ImportError: Cannot import site module and its dependencies: No module named site

Me sigue pasando.

#5 Updated by Joaquín del Cerro Murciano over 8 years ago

  • Status changed from New to Fixed

Al parecer en windows no localizaba correctamente el "python.home".
He incluido codigo en el autorun.sh del plugin de python para que localice el jar de jython que se esta usando y establezca el "python.home" a el.

Supongo que con esto no deberia hacer falta lo del "python.cachedir", pero lo voy a dejar ya que me parece mejor dejarlo en el $HOME/gvSIG/... que en la carpeta de la instalacion.

http://www.jython.org/archive/21/docs/registry.html
http://www.jython.org/archive/22/userfaq.html#where-s-the-registry-file

#6 Updated by Antonio Falciano over 8 years ago

  • Status changed from Fixed to Closed

Also available in: Atom PDF