[Jython-checkins] jython: Ensure that the site module is imported when using PythonInterpreter
jim.baker
jython-checkins at python.org
Sat Jun 28 03:28:23 CEST 2014
http://hg.python.org/jython/rev/51b28cc2c43d
changeset: 7332:51b28cc2c43d
user: Timothée Lecomte <lecomte.timothee at gmail.com>
date: Fri Jun 27 17:23:51 2014 -0600
summary:
Ensure that the site module is imported when using PythonInterpreter
files:
src/org/python/util/PythonInterpreter.java | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/org/python/util/PythonInterpreter.java b/src/org/python/util/PythonInterpreter.java
--- a/src/org/python/util/PythonInterpreter.java
+++ b/src/org/python/util/PythonInterpreter.java
@@ -8,6 +8,8 @@
import org.python.antlr.base.mod;
import org.python.core.CompileMode;
import org.python.core.CompilerFlags;
+import org.python.core.imp;
+import org.python.core.Options;
import org.python.core.ParserFacade;
import org.python.core.Py;
import org.python.core.PyCode;
@@ -118,6 +120,11 @@
PyModule module = new PyModule("__main__", dict);
systemState.modules.__setitem__("__main__", module);
}
+
+ if (Options.importSite) {
+ // Ensure site-packages are available
+ imp.load("site");
+ }
}
public PySystemState getSystemState() {
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list