From: Robert T. <das...@gm...> - 2007-12-12 19:43:41
|
Hi, Thanks for the reply! I purposefully omitted the '' round hello to raise an error. My problem is that the error message is still printed to stderr rather than the object stream I created in setErr(). Thanks again! Robert On 12/12/2007, Philip Jenvey <pj...@gr...> wrote: > > On Dec 12, 2007, at 10:44 AM, Robert Taylor wrote: > > > Hi, > > > > I've just started using Jython and am really impressed with it. I've > > run into a problem though and have no idea how to fix it. > > > > The code is: > > > > PythonInterpreter py = new PythonInterpreter(); > > py.setErr(new OutputStream() { > > > > @Override > > public void write(int b) throws IOException { > > System.out.println((char)b); > > } > > }); > > py.exec("print Hello"); > > > > The error message: > > > > Exception in thread "main" Traceback (innermost last): > > File "<string>", line 1, in ? > > NameError: Hello > > Java Result: 1 > > > > I'm not sure what "Java Result: 1" here means -- but it just seems > like the variable named Hello doesn't exist. You'd get that same > error with CPython. > > You might have meant: py.exec("print 'Hello'") > > -- > Philip Jenvey > > > |