Subject: RE: [Jython-users] jruby inside jython
Date: Tue, 20 Nov 2007 10:14:05 -0600
To: email@example.com; firstname.lastname@example.org
Iím not sure if you got any sort of response. so Iíll provide what I can so you donít feel like youíve been forgotten. J
First a disclaimer, I know very little about Ruby / jRuby.
Wrt running jruby inside Jython. I havenít heard of, or seen any reference to any doing anything like that. Honestly in my mind it begs the question; why would I want to do that any way? Could jython be run from jrubyÖ.would I even want to do that?
Based on the stack dump that you provided Iíd say that it looks like the error is coming from jruby, but I could be wrong. This is a pretty esoteric question so I suspect there are very few that have even tried it. My best suggestion is try the ruby lists again. I know Charles Nutter has some experience with both Jython and JRuby but I donít if even he would have tried this.
From: email@example.com [mailto:firstname.lastname@example.org] On Behalf Of adam goucher
Sent: Thursday, November 15, 2007 7:41 PM
Subject: [Jython-users] jruby inside jython
I originally sent this to the jruby list, but did not get any solutions. Has anyone on this side of things had success running jruby inside jython for running ruby unit tests?
(I tried to search the archives, but it wasn't working...)
I'm trying to use JRuby in Jython via the JSR-233 engine. The ruby script is a Test::Unit::TestCase originating one and runs from the command line using the regular ruby interpreter. When I try to run it from it from inside my script however, things get ugly. I'm rather confused as to why it is blowing up in the way it is, but realize that it might be something trivial to make it work and having hit the 'spent enough time not figuring it out' its off to the mailing list.
So can anyone shed light into the origin of the backtrace or have solved this problem a different way?
Note: r.eval('puts "Hello!"') works fine, it is just when I pass in this script that it does not work.
class ExampleTest < Test::Unit::TestCase
m = javax.script.ScriptEngineManager()
r = m.getEngineByName("jruby")
rs = open(f, "r")
y = r.eval(rs.read())
Traceback (innermost last):
File "jpythonruby.py", line 48, in ?
method `sub' called for nil:NilClass (NoMethodError)
from C:/temp/jpythonruby/jruby-1.0.2/lib/ruby/1.8/test/unit.rb:2:in `call'
from C:/temp/jpythonruby/jruby-1.0.2/lib/ruby/1.8/test/unit/autorunner.rb:198:in `run'
from C:/temp/jpythonruby/jruby-1.0.2/lib/ruby/1.8/test/unit/autorunner.rb:13:in `run'
...internal jruby stack elided...
from sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
from org.python.core.PyReflectedFunction.__call__(Unknown Source)
from org.python.core.PyMethod.__call__(Unknown Source)
from org.python.core.PyObject.__call__(Unknown Source)
from org.python.core.PyInstance.invoke(Unknown Source)
from org.python.core.PyTableCode.call(Unknown Source)
from org.python.core.PyCode.call(Unknown Source)
from org.python.core.Py.runCode(Unknown Source)
from org.python.core.__builtin__.execfile_flags(Unknown Source)
from org.python.util.PythonInterpreter.execfile(Unknown Source)
from org.python.util.jython.main(Unknown Source)
Are you ready for Windows Live Messenger Beta 8.5 ? Get the latest for free today!
Have fun while connecting on Messenger! Click here to learn more.
This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.