Revision 724 org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/resources/org/gvsig/scripting/langs/python/init.txt
init.txt | ||
---|---|---|
4 | 4 |
|
5 | 5 |
def __init_python_path(): |
6 | 6 |
import sys |
7 |
from org.gvsig.scripting import ScriptingLocator |
|
7 | 8 |
|
8 | 9 |
new_path = list() |
9 | 10 |
new_path.append(sys.path[0]) |
... | ... | |
34 | 35 |
path = folder.getFile().getCanonicalPath() |
35 | 36 |
if not path in new_path: |
36 | 37 |
new_path.append(path) |
38 |
|
|
37 | 39 |
new_path.append("__classpath__") |
38 | 40 |
new_path.append("__pyclasspath__/") |
41 |
|
|
42 |
# Add global libs from uselib module |
|
43 |
# Deben ir a final para reproducir el mismo entorno que tenia el script cuando |
|
44 |
# se ejecuto e hizo el use_xxx. |
|
45 |
manager = ScriptingLocator.getManager() |
|
46 |
global_path = manager.getProperty("jython.global.path") |
|
47 |
if global_path != None: |
|
48 |
new_path.extend(global_path) |
|
49 |
|
|
39 | 50 |
del sys.path[:] |
40 |
sys.path.extend(new_path) |
|
51 |
for path in new_path: |
|
52 |
sys.path.append(path) |
|
41 | 53 |
|
42 | 54 |
|
43 | 55 |
__init_python_path() |
Also available in: Unified diff