summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
d556dfd)
gitlab #2
Change-Id: I2e568ca49e0974cb4b7aedbdc14e00c594f991e8
Export-Package: org.simantics.pythonlink\r
Bundle-Activator: org.simantics.pythonlink.Activator\r
Bundle-ActivationPolicy: lazy\r
Export-Package: org.simantics.pythonlink\r
Bundle-Activator: org.simantics.pythonlink.Activator\r
Bundle-ActivationPolicy: lazy\r
+Import-Package: org.slf4j\r
\r
import org.osgi.framework.BundleActivator;\r
import org.osgi.framework.BundleContext;\r
\r
import org.osgi.framework.BundleActivator;\r
import org.osgi.framework.BundleContext;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
\r
public class Activator implements BundleActivator {\r
\r
\r
public class Activator implements BundleActivator {\r
\r
+ private static final Logger LOGGER = LoggerFactory.getLogger(Activator.class);\r
private static BundleContext context;\r
\r
private static BundleContext context;\r
\r
+ private static boolean loaded = false;\r
+ \r
static BundleContext getContext() {\r
return context;\r
}\r
static BundleContext getContext() {\r
return context;\r
}\r
*/\r
public void start(BundleContext bundleContext) throws Exception {\r
Activator.context = bundleContext;\r
*/\r
public void start(BundleContext bundleContext) throws Exception {\r
Activator.context = bundleContext;\r
- System.loadLibrary("jnipython");\r
+ try {\r
+ System.loadLibrary("jnipython");\r
+ loaded = true;\r
+ } catch (Exception e) {\r
+ LOGGER.error("Loading of jnipython.dll failed", e);\r
+ }\r
+ }\r
+ \r
+ public static boolean isPythonLoaded() {\r
+ return loaded;\r
};
private static synchronized void ensurePythonInit() {
};
private static synchronized void ensurePythonInit() {
+ if (!Activator.isPythonLoaded()) {
+ throw new PythonException("Python interpreter has not been successfully loaded. Check availablility of python3.dll in path.");
+ }
+
if (!isPyInitialized) {
execute(() -> initializePython(pythonWriter));
isPyInitialized = true;
if (!isPyInitialized) {
execute(() -> initializePython(pythonWriter));
isPyInitialized = true;