Dear All,
Please accept this patch which is diff which implements the iexec() method
and sets the standard output and err streams properly
Regards !!
Sanka Samaranayake <[EMAIL PROTECTED]>
***********************************************************************
***********************************************************************
--- JPythonEngine.java 2004-04-08 16:50:42.000000000 +0600
+++ JPythonEngineModified.java 2004-05-02 00:32:46.000000000 +0600
@@ -141,6 +141,10 @@
// create an interpreter
interp = new PythonInterpreter ();
+
+ //ensures that the output and err streams are redirected correctly
+ interp.setOut(System.out);
+ interp.setErr(System.err);
// register the mgr with object name "bsf"
interp.set ("bsf", new BSFFunctions (mgr, this));
@@ -165,4 +169,25 @@
}
return result;
}
+
+ public void iexec(String source, int lineNo, int columnNo, Object
script) throws BSFException{
+ // implementation of this method differs to exec() only in that it
executes
+ // the code upto the first new line character
+
+ String scriptStr = script.toString();
+ int index = scriptStr.indexOf("\n");
+
+ if (index > -1){
+ scriptStr = scriptStr.substring(0,index);
+ }
+
+ try{
+ interp.exec(scriptStr.toString());
+
+ }catch(PyException pye){
+ throw new BSFException(BSFException.REASON_EXECUTION_ERROR,
+ "exception in jpython "+pye,pye);
+ }
+
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]