Maybe simple question, maybe not.

I need to be able to execfile( "" ) from an Eclipse plugin. The functionality is part of the PyDev effort. I came up with the (maybe clever / maybe not) strategy of using Jython from Eclipse to invoke introspect, handing it the code being edited s/t it can suggest autocompletions in the fashion of pyAlaMode, and JythonConsole. That's the backstory.



Now the problem:



I have wrapped Jython.jar s/t it's accessible from Eclipse as required by the "laws of eclipse" :-) and calling the interpreter certainly seems to work for the simple stuff. For example,

interp.exec("print 'HelloWorld'");

certainly works.

However certain imports in jython/lib don't seem to; the ones I have commented out which are imports used in other modules that I want to execfile on. I am wondering why they don't work?

interp.exec("from debug import *");

interp.exec("import cStringIO");

interp.exec("import imp");

interp.exec("import os");

// interp.exec("import re"); // JYTHON_HOME/Lib ?? Why not??

// interp.exec("import string"); // JYTHON_HOME/Lib ?? Why not??

interp.exec("import sys");

// interp.exec("import tokenize"); // JYTHON_HOME/Lib ?? Why not??

interp.exec("import types");

// interp.exec("import unittest"); // JYTHON_HOME/Lib ?? Why not??


That's something I would like someone with insights into to kindly advance some advice






Ultimately more important to me (actually for the users of PyDev) is the notion that I want to be able to load everything required for Jython to be useable from Eclipse into a jar and have the running prog reference the stuff from there. I am wondering whether anyone else has thoughts on this.

If it turns out that I haven't done very complete homework, please castigate accordingly and I will slink away. If OTOH these are interesting questions, I appreciate your time.



Dana Moore

Senior Scientist

BBN Technologies

phone (mobile): (240) 350-4196

phone (voice mail): (703) 284-1228

phone (DARPA TIC): (703) 486-4542

fax: (703) 284-1300


YM: dana_virtual