Hello,
I want to use pydev in my rcp application and I have some questions.
First of all, is org.python.pydev.jython used internally from pydev so as to funciton? It is used in the editor only if the project is jython or both for jython and python? Is it possible to use this embeded interpreter as the execution interpreter? How could I do this programmatically? Have you tried the newest jython 2.2.1 version? Is it easy to create some custom (with custom classpath) interpreter (maybe along with the jython 2.1), in a plugin, that will be used as the executing interpreter or the editor interpreter? Where in the code should I look to find the initilization of the interpreter?
Thanx in advance,
Kostas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
org.python.pydev.jython is only used internally from pydev.
Jython 2.2.1 will probably be integrated to be used internally at some point in the future.
There's no 'easy' API to create a custom interpreter.
The initialization may be found at PythonInterpreterPreferencesPage / PythonInterpreterEditor (actually, most of the implementation is in the superclass of those).
Cheers,
Fabio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanx for your answer. I see it is difficult to some modifications there. But still can't find the initialization of the jython interpreter for the Editor. I mean it is needed to be initialized, so as for the editor capabilities to work. For the executor I guess it starts a different process.
Regards Kostas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The class directly responsible for executing the jython scripts for the editor is org.python.pydev.editor.scripting.PyEditScripting.
Also, take a look at the org.python.pydev.jython.JythonPlugin. It's responsible for initializing the internal interpreter and has a number of exec() methods to execute some jython file(s).
Cheers,
Fabio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello again,
This isn't what I want. I got it all wrong that's why I didn't make the right question so as to get the right answer.My fault.
What I want is to have embeded the editor with code completon and all this stuff. But I also want to initialize every project, that the user creates, with my own libraries (jars, etc), programatically. I thought that the interpreter plays some role on this. But as I searched more on it, It seemed not. So what I am looking for is where in pydev does project's pythonpath gets initialized/edited so as to be able to initialize it with my own libraries.
I hope this time I explained better.
Best regards,
Kostas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello again,
I investigate more the pydev code and I really need your more help if you could.
I try to set the jython interpreter from my own rcp with pydev. If I export the rcp application then it sets the interpreter kind of well. However, if I run it from inside eclipse and select the jython.jar I get an exception
......
JDT not available.
The selected operation could not be completed because the JDT plugin was
not found in your configuration. The JDT (java) plugin is required for
operations that need a java interpreter (mainly for jython development).
So, if you want to use pydev to develop for JYTHON, please install the jdt
plugin (available in the Eclipse SDK). If that's not the case, please close
any project you have configured as being a jython project.
at org.python.pydev.editor.codecompletion.revisited.javaintegration.JythonModulesManagerUtils.tryRethrowAsJDTNotAvailableException(JythonModulesManagerUtils.java:39)
at org.python.copiedfromeclipsesrc.JavaVmLocationFinder$1.call(JavaVmLocationFinder.java:71)
at org.python.copiedfromeclipsesrc.JavaVmLocationFinder.findDefaultJavaExecutable(JavaVmLocationFinder.java:37)
at org.python.pydev.runners.SimpleJythonRunner.runAndGetOutputWithJar(SimpleJythonRunner.java:41)
....
and if I mchange it so as to print the real exception I get
....
Error received...
java.lang.RuntimeException: java.lang.NullPointerException
java.lang.NoClassDefFoundError: org/eclipse/jdt/launching/JavaRuntime
at org.python.copiedfromeclipsesrc.JavaVmLocationFinder$1.call(JavaVmLocationFinder.java:67)
at org.python.copiedfromeclipsesrc.JavaVmLocationFinder.findDefaultJavaExecutable(JavaVmLocationFinder.java:37)
at org.python.pydev.runners.SimpleJythonRunner.runAndGetOutputWithJar(SimpleJythonRunner.java:41)
at org.python.pydev.ui.interpreters.JythonInterpreterManager.doCreateInterpreterInfo(JythonInterpreterManager.java:69)
at org.python.pydev.ui.interpreters.JythonInterpreterManager.createInterpreterInfo(JythonInterpreterManager.java:45)
at org.python.pydev.ui.interpreters.AbstractInterpreterManager.getInterpreterInfo(AbstractInterpreterManager.java:220)
........
it seems not to find the JavaRuntime class althoug the plug-in is included in rcp
Any hint would be realy helpful
Another issue is that if interpreter is set, and a pydev projet is created, in the packge explorer view it doesn't appear anything. It's blank.
Best Regards
Kostas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I eventually tried the Eclipse 3.4RC3 and it worked with pydev, after a few minor changes. Now the rcp gets the jython interpreter. Also I managed to set the interpreter programmatically propably without problems. Now the problem is that in the project explorer when I create a project, the project doesn't go in the package explorer and completion don't work. So propably some extensions don't work, or don't get fired-triggered (or whatever is tha name) by the RCP as it does the real Eclipse IDE. So any hint on how the extensions could be enabled would be really helpful
Best regards,
Kostas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
One place that uses the internal API for that is org.python.pydev.editor.codecompletion.revisited.javaintegration.AbstractJavaIntegrationTestWorkbench
It creates and configures a jython interpreter, a project with references, source folder, creates files at runtime and checks if code-completion works on the workbench, so, all that you need regarding using the pydev API to setup the environment can probably be gotten in that test.
Cheers,
Fabio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I want to use pydev in my rcp application and I have some questions.
First of all, is org.python.pydev.jython used internally from pydev so as to funciton? It is used in the editor only if the project is jython or both for jython and python? Is it possible to use this embeded interpreter as the execution interpreter? How could I do this programmatically? Have you tried the newest jython 2.2.1 version? Is it easy to create some custom (with custom classpath) interpreter (maybe along with the jython 2.1), in a plugin, that will be used as the executing interpreter or the editor interpreter? Where in the code should I look to find the initilization of the interpreter?
Thanx in advance,
Kostas
org.python.pydev.jython is only used internally from pydev.
Jython 2.2.1 will probably be integrated to be used internally at some point in the future.
There's no 'easy' API to create a custom interpreter.
The initialization may be found at PythonInterpreterPreferencesPage / PythonInterpreterEditor (actually, most of the implementation is in the superclass of those).
Cheers,
Fabio
Thanx for your answer. I see it is difficult to some modifications there. But still can't find the initialization of the jython interpreter for the Editor. I mean it is needed to be initialized, so as for the editor capabilities to work. For the executor I guess it starts a different process.
Regards Kostas
The class directly responsible for executing the jython scripts for the editor is org.python.pydev.editor.scripting.PyEditScripting.
Also, take a look at the org.python.pydev.jython.JythonPlugin. It's responsible for initializing the internal interpreter and has a number of exec() methods to execute some jython file(s).
Cheers,
Fabio
Hello again,
This isn't what I want. I got it all wrong that's why I didn't make the right question so as to get the right answer.My fault.
What I want is to have embeded the editor with code completon and all this stuff. But I also want to initialize every project, that the user creates, with my own libraries (jars, etc), programatically. I thought that the interpreter plays some role on this. But as I searched more on it, It seemed not. So what I am looking for is where in pydev does project's pythonpath gets initialized/edited so as to be able to initialize it with my own libraries.
I hope this time I explained better.
Best regards,
Kostas
Hello again,
I investigate more the pydev code and I really need your more help if you could.
I try to set the jython interpreter from my own rcp with pydev. If I export the rcp application then it sets the interpreter kind of well. However, if I run it from inside eclipse and select the jython.jar I get an exception
......
JDT not available.
The selected operation could not be completed because the JDT plugin was
not found in your configuration. The JDT (java) plugin is required for
operations that need a java interpreter (mainly for jython development).
So, if you want to use pydev to develop for JYTHON, please install the jdt
plugin (available in the Eclipse SDK). If that's not the case, please close
any project you have configured as being a jython project.
at org.python.pydev.editor.codecompletion.revisited.javaintegration.JythonModulesManagerUtils.tryRethrowAsJDTNotAvailableException(JythonModulesManagerUtils.java:39)
at org.python.copiedfromeclipsesrc.JavaVmLocationFinder$1.call(JavaVmLocationFinder.java:71)
at org.python.copiedfromeclipsesrc.JavaVmLocationFinder.findDefaultJavaExecutable(JavaVmLocationFinder.java:37)
at org.python.pydev.runners.SimpleJythonRunner.runAndGetOutputWithJar(SimpleJythonRunner.java:41)
....
and if I mchange it so as to print the real exception I get
....
Error received...
java.lang.RuntimeException: java.lang.NullPointerException
java.lang.NoClassDefFoundError: org/eclipse/jdt/launching/JavaRuntime
at org.python.copiedfromeclipsesrc.JavaVmLocationFinder$1.call(JavaVmLocationFinder.java:67)
at org.python.copiedfromeclipsesrc.JavaVmLocationFinder.findDefaultJavaExecutable(JavaVmLocationFinder.java:37)
at org.python.pydev.runners.SimpleJythonRunner.runAndGetOutputWithJar(SimpleJythonRunner.java:41)
at org.python.pydev.ui.interpreters.JythonInterpreterManager.doCreateInterpreterInfo(JythonInterpreterManager.java:69)
at org.python.pydev.ui.interpreters.JythonInterpreterManager.createInterpreterInfo(JythonInterpreterManager.java:45)
at org.python.pydev.ui.interpreters.AbstractInterpreterManager.getInterpreterInfo(AbstractInterpreterManager.java:220)
........
it seems not to find the JavaRuntime class althoug the plug-in is included in rcp
Any hint would be realy helpful
Another issue is that if interpreter is set, and a pydev projet is created, in the packge explorer view it doesn't appear anything. It's blank.
Best Regards
Kostas
Hello again,
I eventually tried the Eclipse 3.4RC3 and it worked with pydev, after a few minor changes. Now the rcp gets the jython interpreter. Also I managed to set the interpreter programmatically propably without problems. Now the problem is that in the project explorer when I create a project, the project doesn't go in the package explorer and completion don't work. So propably some extensions don't work, or don't get fired-triggered (or whatever is tha name) by the RCP as it does the real Eclipse IDE. So any hint on how the extensions could be enabled would be really helpful
Best regards,
Kostas
One place that uses the internal API for that is org.python.pydev.editor.codecompletion.revisited.javaintegration.AbstractJavaIntegrationTestWorkbench
It creates and configures a jython interpreter, a project with references, source folder, creates files at runtime and checks if code-completion works on the workbench, so, all that you need regarding using the pydev API to setup the environment can probably be gotten in that test.
Cheers,
Fabio